Create a Dark light theme switch | javaScript

Publicado em: 24 Agosto 2020
no canal de: Deepak Karanjekar
47
4

How to create a Dark / Light theme switch using javascript.

To achieve this result, we are going to define all our project colors using CSS custom properties; and then, when a specific data attribute (or you can use a CSS class) is added to the body element, we update all these CSS variables with their new dark-theme values.

For example, we can use the color white as the default background-color for a component, and then change it to black when a data-theme="dark" is added to the body element:

Github link - https://github.com/deepakaranjekar/da...

W3schools toggle HTML and css link - https://www.w3schools.com/howto/howto...


Nesta página do site você pode assistir ao vídeo on-line Create a Dark light theme switch | javaScript duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Deepak Karanjekar 24 Agosto 2020, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 47 vezes e gostou 4 espectadores. Boa visualização!