// ==UserScript== // @name DarkSnap // @namespace http://tampermonkey.net/ // @match https://snap.berkeley.edu/* // @exclude *://snap.berkeley.edu/snap/* // @grant none // @version 1.01 // @author Swee // @description Fork of https://forum.snap.berkeley.edu/t/18272 // @run-at document-end // ==/UserScript== // if (document.querySelectorAll('[data-bs-theme]').length > 0) { // Set the data-bs-theme attribute to "dark" // By doing some inspectation I determined a lot of pages use // bootstrap 5, and this is how you make bootstrap go in dark mode document.documentElement.setAttribute('data-bs-theme', 'dark'); } else { // Dark mode patches for non-bootstrap pages const noBoostrapStyle = document.createElement('style'); noBoostrapStyle.innerHTML = ` body { background: #212529; } .notes { background: #2D3142 !important; } .trapezoid { color: #2D3142; } `; document.head.appendChild(noBoostrapStyle); } // Apply styles to force body to white const style = document.createElement('style'); style.innerHTML = ` body { color: white; } .trapezoid-footer { color: #212529; } `; document.head.appendChild(style); console.info("Loaded DarkSnap.")