User:Crashaholic/vector.js
Jump to navigation
Jump to search
var currentMode = 0; // 0 is dark, 1 is light
// used by the text to determine toggle text
// is 0 by default cuz, well, the site's default is dark
// plan: write to cookie to store light or dark mode persistency
// cuz it actually would be annoying to keep clicking
// this cookie should only be for the user who has this script
// trying to say that this whole thing should *generally* be safe
// i hope
// how tf do i do cookies LMAO
// creates the toggle in the page
// will be beside the user's name in the "vector-menu-content-list"
function create_night_mode_toggle()
{
var node1 = document.createElement('li');
var node2 = document.createElement('a');
var foo = document.querySelector('.vector-menu-content-list');
foo.prepend(node1);
node1.appendChild(node2);
node2.setAttribute('href', 'google.com');
node2.innerText = "abcd";
node1.classList += "mw-list-item";
}
create_night_mode_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_var("--bg-main", "rgb(240, 234, 214)");
set_var("--bg-main2", "rgb(243, 235, 205)");
set_var("--bg-main3", "rgb(240, 226, 179)");
set_var("--bg-dark", "rgb(240, 234, 214)");
set_var("--bg-darker", "rgb(243, 235, 205)");
set_var("--bdr-white", "rgb(85, 85, 85)");
set_var("--bdr-color", "rgb(134, 87, 33)");
set_var("--bdr-hl", "rgb(240, 174, 121)");
set_var("--fg", "rgb(44, 34, 16)");
set_var("--fg-light", "rgb(66, 54, 30)");
set_var("--fg-dark ", "rgb(22, 22, 14)");
set_var("--link", "rgb(162, 87, 59)");
set_var("--link-vis", "rgb(89, 125, 11)");
set_var("--link-new", "rgb(232, 32, 6)");
set_var("--btn-bg", "rgb(228, 210, 174)");
set_var("--btn-bdr", "rgb(61, 43, 8)");
set_var("--btn-fg", "rgb(44, 34, 16)");
set_var("--btn-bg-hl", "rgb(241, 216, 166)");
set_var("--btn-bdr-hl", "rgb(102, 75, 21)");
set_var("--btn-fg-hl", "rgb(44, 34, 16)");
set_var("--btn-active-bg", "rgb(223, 195, 141)");
set_var("--btn-active-bdr", "rgb(61, 43, 8)");
set_var("--btn-active-fg", "rgb(44, 34, 16)");
back to dark mode i go*/