In this video I show you how to change a CSS Variable with Javascript, we will change the background to a fixed value and the text color will be selectable via a color input field.
The nice thing about Scrimba is, you can pause and change the code yourself to see more clearly how everything works!
Change a CSS Variable with Javascript Video on Scrimba
If you prefer YouTube, I uploaded a screen recording of the Scrimba.
Change a CSS Variable with Javascript Video on YouTube
Follow my YouTube channel for more videos, as I will not create a blog post for every video.