JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<body>
<div></div>
<button onclick="document.querySelector('html').classList.toggle('blue')">
Toggle
</button>
</body>
</html>
CSS
:root {
--bg: red;
}
:root.blue {
--bg: blue;
}
div {
width: 50px;
height: 50px;
background: var(--bg);
}