js variable as css color code example
Example: how to change a css variable with javascript
var root = document.querySelector(':root');
root.style.setProperty('--variable', 'lightblue');
/or/
root.style.setProperty('--variable', myColor);
var root = document.querySelector(':root');
root.style.setProperty('--variable', 'lightblue');
/or/
root.style.setProperty('--variable', myColor);