Variáveis de CSS datilografadas
document.documentElement.style.setProperty("--main-background-color", "green");
PYTHON_NOT_SNAKE.py
document.documentElement.style.setProperty("--main-background-color", "green");
const styling: { name: string, value: string }[] = [
{ name: "--primary", value: "#123456" }
];
let styleElement: HTMLElement = document.createElement( 'style' );
let cssVariable: string = '';
for ( let i = 0; i < styling.length; i++ ) {
cssVariable += styling[i].name + ':' + styling[i].value + ';';
}
styleElement.innerText = ':root { ' + cssVariable + ' }';
document.getElementsByTagName( 'head' )[0].appendChild( styleElement );