User:Crashaholic/vector.js: Difference between revisions
Jump to navigation
Jump to search
Crashaholic (talk | contribs) (Created page with "function create_nightmode_toggle() { }") |
Crashaholic (talk | contribs) No edit summary |
||
Line 3: | Line 3: | ||
} | } | ||
// Get the root element | |||
var r = document.querySelector(':root'); | |||
// Create a function for getting a variable value | |||
function get_var(name) { | |||
// Get the styles (properties and values) for the root | |||
var rs = getComputedStyle(r); | |||
rs.getPropertyValue(name); | |||
} | |||
// Create a function for setting a variable value | |||
function set_var(name, value) { | |||
// Set the value of variable --blue to another value (in this case "lightblue") | |||
r.style.setProperty(name, value); | |||
} | |||
set_val("--bg-main", "#FFFCF2"); | |||
set_val("--bg-main2", "#fff9e2"); | |||
set_val("--bg-main3", "#fff0be"); | |||
set_val("--bg-dark", "#fff9e2"); | |||
set_val("--bg-darker", "#FFFCF2"); | |||
set_val("--bdr-white", "rgb(223, 222, 218)"); | |||
set_val("--bdr-color", "rgb(219, 163, 52)"); | |||
set_val("--bdr-hl", "rgb(240, 174, 121)"); | |||
set_val("--fg", "rgb(71, 65, 34)"); | |||
set_val("--fg-light", "rgb(94, 90, 80)"); | |||
set_val("--fg-dark ", "rgb(15, 15, 14)"); | |||
set_val("--link ", "rgb(134, 77, 10)"); | |||
set_val("--link-vis", "rgb(109, 51, 0)"); | |||
set_val("--link-new", "rgb(211, 142, 38)"); |
Revision as of 13:27, 6 September 2023
function create_nightmode_toggle()
{
}
// Get the root element
var r = document.querySelector(':root');
// Create a function for getting a variable value
function get_var(name) {
// Get the styles (properties and values) for the root
var rs = getComputedStyle(r);
rs.getPropertyValue(name);
}
// Create a function for setting a variable value
function set_var(name, value) {
// Set the value of variable --blue to another value (in this case "lightblue")
r.style.setProperty(name, value);
}
set_val("--bg-main", "#FFFCF2");
set_val("--bg-main2", "#fff9e2");
set_val("--bg-main3", "#fff0be");
set_val("--bg-dark", "#fff9e2");
set_val("--bg-darker", "#FFFCF2");
set_val("--bdr-white", "rgb(223, 222, 218)");
set_val("--bdr-color", "rgb(219, 163, 52)");
set_val("--bdr-hl", "rgb(240, 174, 121)");
set_val("--fg", "rgb(71, 65, 34)");
set_val("--fg-light", "rgb(94, 90, 80)");
set_val("--fg-dark ", "rgb(15, 15, 14)");
set_val("--link ", "rgb(134, 77, 10)");
set_val("--link-vis", "rgb(109, 51, 0)");
set_val("--link-new", "rgb(211, 142, 38)");