+ 1
Change content colour
Is there a way for me to change all the colours of the content on the page to either black or white depending on if the use has clicked the button without a if else statement? E.g. the user clicks the button making the bg colour black and the text white. https://code.sololearn.com/W38C34qFFlQ3/?ref=app
5 Answers
+ 5
Css vars do the magic...
+ 2
Ever heard of CSS variables? Its pretty more convenient than manual one-by-one styling with JS. Refer to this link:
https://dev.to/ananyaneogi/create-a-dark-light-mode-switch-with-css-variables-34l8
If you feel its kinda hard or complex for ya... remember we all (especially me, just leave a message if you want) got your back for any of your questions.
+ 2
Alfred Juma ill try to look up how to use them
+ 1
Try "toggle class"
+ 1
SPICEAPPLE đ { active: 0 } thanks ill take a look at it and see if i can understand and use it