Here is the simplest way I found to add dark mode to a project:
Add a toggle button in your HTML with a checkbox and an onClick calling a JavaScrip...
For further actions, you may consider blocking this person and/or reporting abuse
In addition you can implement
prefers-color-scheme
media queries to also trigger dark mode, if this is set in user preferences: developer.mozilla.org/en-US/docs/W...I also read somewhere that you can also hook into the ambient sensor of the laptop.
Not sure if the following was the original published source but that's where I read it.
blog.arnellebalane.com/using-the-a...
That's awesome!
Do you have a link to your code? The code I posted in the article are only the parts of the code that have to do with dark/light mode.
I use dark mode too. But your method is more simple and straightforward.
Love the way this dark/light mode functions.
Also, seriously cool cover image for this post. 😀
Thanks 😁!
I added the codepen at the bottom of the article.
But what about IE? Aren't CSS variables not supported in that unsightly browser?
That's pretty slick.
OnClick the C needs to be capitalized
This is pretty awesome. So cool seeing such an easy way to implement such a highly requested feature in many applications.
This is slick. Similar to how DEV does it but this is more elegant.
Thank you for the kind words!
You have two head tags
I'll write this code in a codesandbox and add it to the article.