Using CMS color to style rich text links

I have created a CMS collection where each collection item has a color field specified. These collection items also have a rich text field that includes links and images.

My question is:
Is it possible to use the specified color as the link color for links in the rich text element on each list item’s page?

I have a blog and each post is made of a rich text field and has a unique color assigned to it for text links.

Is there a way to make this work?

This would require custom coding and it is doable.

Would appreciate any help in that regard! Thanks in advance.

Say the class you gave to your RT is .myrt

Add this custom code inside of an Embed component inside the CMS context (CMS template page or col list):

.myrt a {color:X!important}

This code means "Define color on all links inside an element with the class .myrt

Now select the X, click on Add field and select the CMS color field. So it looks like this:

Results should show up in the designer.

Thank you so much!! Greatly appreciated!

1 Like