how to put a color variable from js to css code example
Example 1: how to change css variable in javascript
document.documentElement.setAttribute("style", "--main-background-color: green");
Example 2: css variables
:root {
--background-color: #333;
--text-color: #fff;
}
body {
background-color: var(--background-color);
color: var(--text-color);
}