9341 shaares
224 private links
224 private links
There are many approaches.
One solution is to set the color-schema CSS property color-scheme: light dark;
then use the light-dark
function.
But did you know that you can also set the
media
attribute to conditionally load and apply CSS based on user preferences? Such asmedia="(prefers-color-scheme: light)"
This media
attribute can also be set in JS too, in order to load the proper stylesheet.