How to let visitors change colour of website?


How can I create this interactive effect where visitors are allowed to change the colour of the website?


is it possible to do this in Wix? Are there custom codes I can use?

I cannot answer for Wix. Only “normal” web sites :slight_smile:

One way to do this is using CSS. Then using HTML dataset to make it persistent. And Javascript to set and change the dataset.

1 Like

Yes, it’s really pretty simple. I’d put a class on the body to change the theme, and use Javascript to change the class.

Interactive Effect Where Visitors Are Allowed To Change The Colour of The Website.

Bro Did you do this for me?
My Website Developed in php Codeignitor Using Ci Frame Work…

An important requirement is whether you want to persist the selection. Apparently that website does not support that.

One possible way to do it is to use a HTML dataset, as sibertius said. I assume that could work, I am not familiar with it.

Another way is with cookies.

If your site requires login then the choice can be saved with the account information.

Browsers support other ways for websites to store data locally and I spent many hours trying to get something working using something like that. I considered asking here for help with the details but that was about 4 years ago.

As for how that website does what it does, we can use the developer tools that browsers have. I see that the circles in the top left have CSS classes corresponding for each of the colors, such as for Green. The CSS classes are in the file estie-9daa70.webflow.css.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.