nixos/system/bookmarks/darkmode.js

16 lines
554 B
JavaScript

// From https://www.geeksforgeeks.org/how-to-make-dark-mode-for-websites-using-html-css-javascript/
// See also https://www.w3schools.com/howto/howto_js_toggle_dark_mode.asp
function darkMode() {
let element = document.body;
let content = document.getElementById("DarkModetext");
element.className = "dark-mode";
content.innerText = "Dark Mode is ON";
}
function lightMode() {
let element = document.body;
let content = document.getElementById("DarkModetext");
element.className = "light-mode";
content.innerText = "Dark Mode is OFF";
}