Skip to content

Instantly share code, notes, and snippets.

@nileane
Created August 19, 2025 12:36
Show Gist options
  • Save nileane/8418ebb86e99fcaa08980b342e3add44 to your computer and use it in GitHub Desktop.
Save nileane/8418ebb86e99fcaa08980b342e3add44 to your computer and use it in GitHub Desktop.
UserScript: Always keep YouTube header in dark mode
// ==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