There are multiple ways to switch dark and light themes — mostly using scripts and few of them using CSS. Let me show you one quick and easy way to switch themes.
The idea is to get the value of use click. We can easily do that using a script but there’s a straightforward way to do the same using CSS too.
We are not going to show the input element — it will be hidden. The label will be visible and when the user clicks on the label texts, the input will be updated and we will get what we want.
Let’s add some basic styles and make the container of hull height.
Finally, change the background and color on click (when the checkbox is checked)
To show user which mode is ON, we can add the ON and OFF after the label texts. Just like this:
color dark input labels light pure CSS theme