Instead of a checkbox, you could be even lazier and use the prefers-color-scheme media query: @media (prefers-color-scheme: dark) { ... }