A theme button on a website?
How to implement a button on the site that, when clicked, you can change the site theme from dark to white.
1.tag html add the parameter data-theme
2. in styles, set colors through variables in : root
3. Change the value for data-theme via JSAnonymous
You have 2 color schemes in different files.
White.css is loaded by default
The user clicks a button, js sets a checkbox in cookies or locastoredzh that it is necessary to load black.css and either on the fly or on reboot another theme is loaded (via link in the markup head)Harper Harper
To place the code, please use CodePen or similar tool. Thanks you!