Is is possible in webflow to change the color of a text element or the background of div in a collection list based simply on whether a switch is on or off?
With a div background, this can be hacked by absolutely positioning the a div with the desired color on top of the parent div and setting its visibility conditional to whether the switch is on, but is there an easier way (without the color field in CMS having to be manually set)?
And is it possible at all with text color? I’m wracking my brain to no avail.
This probably/most likely could be done, but it would all be custom code.
The process you described is probably the easiest and less complicated way of doing it.
Wish I had better news for you.
Was your project successful? Do you have any experience to share on how to do it in Webflow-only without using custom code?
Hopefully this has been solved - but here’s my Webflow-only solution:
- Create a Div containing the text blocks you’re trying to invert (named mine “Light Text Div”)
- Duplicate the “Light Text Div”
- (on 2nd Div) Delete the class, and add a new class called “Dark Text Div”
- In the CMS Panel, add a ‘Switch’ in your collection settings named “Invert Color”
- Turn it on for the CMS items that require it (inside CMS panel)
- Go back to the “Light Text Div” and set Conditional Visibility to: Element is Visible when > “Invert Color” is off/on
- Same thing for “Dark Text Div”, just opposite setting (on/off)
Should be good to go! Happy webflowing