Working on a website and I want to add a light / dark theme. I also want to add a toggle on the page to switch between those two modes.
By default, it goes with the system color theme and then overrides are set with localstorage on the color toggle.
What is the best way to implement the styles?
Is using css vars with a selector between light and dark the best move?
Should there be a default styling and then override based on a data attribute on body? (Would this cause flashing on load?)
Any advice helps. Thanks in advance!