Note that you cannot simply use:
- Code: Select all
body.className = "dark"
...because this will not work with multiple class names ("dark" will replace all existing class names). You need a way to add and remove class names. Fortunately, you can use
this javascript.
This is really useful in other situations too.
I should note that, one day, style switching
might become common user behaviour, with prominent, intuitive browser controls. If this ever happens, my method will become bad. But until then, I like my method better.
