Last active
September 7, 2025 16:11
-
-
Save surfaceflinger/6e95c6e2151fc989fb6269da91305869 to your computer and use it in GitHub Desktop.
System light/dark theme preference for Vorapis V3 - oneshotted with claude, might nuke your settings =)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name V3 - System theme | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0.0 | |
// @match *://*.youtube.com/* | |
// @description Sets dark mode in V3 based on system preference | |
// @license MIT | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
const getDarkMode = () => | |
window.matchMedia?.('(prefers-color-scheme: dark)').matches ?? true; | |
const updateTheme = () => { | |
const settings = localStorage.getItem('v3_local_db'); | |
if (!settings) return; | |
try { | |
const parsed = JSON.parse(settings); | |
parsed.config?.db?.yt && (parsed.config.db.yt.DARK_MOD = getDarkMode()); | |
localStorage.setItem('v3_local_db', JSON.stringify(parsed)); | |
} catch { | |
console.error('Could not parse or update theme settings.'); | |
} | |
}; | |
window.matchMedia?.('(prefers-color-scheme: dark)') | |
.addEventListener?.('change', updateTheme); | |
updateTheme(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment