Open nasser-codes opened 1 month ago
https://github.com/woroodfathiassi/Light-Dark-Mode/blob/f84c1846c5d49752e714432ee92f6200fc213381/main.js#L7
because each element is styled differently in dark mode, you are forced to call toggleClass for each individual element. Refactor CSS from patterns like:
header.dark-mode
to
.dark-mode header
and apply the style to only the <body> tag.
<body>
Thank you for this observation.
https://github.com/woroodfathiassi/Light-Dark-Mode/blob/f84c1846c5d49752e714432ee92f6200fc213381/main.js#L7
because each element is styled differently in dark mode, you are forced to call toggleClass for each individual element. Refactor CSS from patterns like:
to
and apply the style to only the
<body>
tag.