What Is the Easiest Way to Add Dark Mode to a Website?
As of now, the vast majority of operating systems and browsers support some sort of dark mode. Gone are the days where various accessibilty modes are touted as a true alternative to the paper white interfaces etched onto our retinas.
What does it take to support a dark mode to a Jekyll website?
The first step is to choose your color pallate. I used this guide as a base to update my current website colors and choose the alternate dark mode colors.
The second step is to create css variables on a pseudo-class to toggle between the two color palletes. We use the css media query “prefers-color-scheme” to have the browser choose the appropriate color pallete.
After this we have to migrate the existing element styling to use these css variables.
At this point, theoretically, the corresponding colors would be loaded by the browser if the user is using dark mode.