this is great and so helpful - thanks so much! I do have one question - in the js, where does "light" come from? unless I'm missing it, that's not defined in the CSS, is it?
You're right, it's not defined anywhere.
If CSS doesn't find any specific styles related to light it will default back to the normal variables defined in :root.
Why I added it?
I added it so that we can use it while checking for the saved theme in localStorage further and add it to the root element. It will also be useful in cases where you might want to add some specific styles for light apart from the default styles.
I hope this helps 🙂
Awesome, thanks so much! Explanation makes perfect sense.
You're welcome 🙂
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.