I checked this topic about CSS variables; Creating CSS Global Variables : Stylesheet theme management
I define global vars,
:root {
--MytextColor: blue;
--MyBackColor: black;
}
and I m able to modify values using javascript with this line,
document.documentElement.style.setProperty('--MyBackColor', 'yellow');
that's fine, but when I refresh the page they return back to original values, is it possible to keep these variables in the memory, or cookies or etc. until we clear browser data (such as full refresh Ctrl+F5).
The reason I was trying that is to make light mode, dark mode using same css class only with css values.