Dark Mode in One Line of Code!


Apps and websites alike seem to be gravitating toward dark modes. Those of us who like to code and read tutorials at midnight will appreciate the dark mode, especially since it is easier on the eyes. The majority of websites do not offer dark mode, which is why I must make it happen.

You can create a dark mode using CSS’s filter, though it isn’t a true “dark mode”:

html {
filter: invert(1);

A website with light-colored themes will be much easier to view if the colors are completely inverted via 1. It’s important to realize that developers should not consider this as a long-term solution, since it’s a fairly lazy solution and is not conducive to branding.


Post a Comment (0)
Previous Post Next Post