Created
August 19, 2025 12:36
-
-
Save nileane/8418ebb86e99fcaa08980b342e3add44 to your computer and use it in GitHub Desktop.
UserScript: Always keep YouTube header in dark mode
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 Always keep YouTube header in dark mode | |
// @namespace https://nileane.fr/ | |
// @version 1.2 | |
// @description Always apply 'dark' + 'theater' + 'is-watch-page' properties, and set 'frosted-glass-mode' property to 'none' on YouTube header | |
// @author Niléane | |
// @match *://www.youtube.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
function applyAttributes() { | |
const masthead = document.querySelector('ytd-masthead'); | |
if (masthead) { | |
masthead.setAttribute('dark', ''); | |
masthead.setAttribute('theater', ''); | |
masthead.setAttribute('is-watch-page', ''); | |
masthead.setAttribute('frosted-glass-mode', 'none'); | |
} | |
} | |
applyAttributes(); | |
const observer = new MutationObserver(applyAttributes); | |
observer.observe(document.body, { childList: true, subtree: true }); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment