r/csshelp • u/cs-063 • Oct 29 '20
Request dark mode for my website
good evening guys. does any one have a 100 percent working code that automatically turns my website into dark mode .
6
Upvotes
6
u/Kthulu666 Oct 29 '20
Nope. What you're asking for isn't a one-size-fits-all solution. Needs to be done custom.
2
1
u/PopeFrancisLegit Oct 29 '20
You can start by using this code that inverts all colors on the webpage:
body {filter: invert();}
You will probably want to keep the colors on images etc., which can be done by inverting them back:
img, .some-class {filter: invert();}
2
u/TheMartinG Oct 30 '20
I made a whole different set of css styles for dark mode. I wanted it to automatically be dark mode at night time
Then I used a small js script to check for the time of day, and grab one css file or the other based on the times I had chosen