Roblox Force Dark Theme

Always forces Roblox to use the Dark theme

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Roblox Force Dark Theme
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Always forces Roblox to use the Dark theme
// @author       Fidelity
// @match        https://www.roblox.com/*
// @icon         https://img.icons8.com/?size=100&id=101343&format=png&color=FFFFFF
// @license      MIT
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function () {
    function SetDarkMode() {
        localStorage.setItem('theme', `{"version":0,"data":[[${document.querySelector('meta[name="user-data"]').dataset.userid},1]]}`);
        document.documentElement.classList.add('dark-theme');
        if (document.body) {
            document.body.classList.remove('system-theme');
            document.body.classList.remove('light-theme');
            document.body.classList.add('dark-theme');
        }
    }

    SetDarkMode();
    document.addEventListener('DOMContentLoaded', SetDarkMode);

    new MutationObserver(() => {
        const el = document.body || document.documentElement;
        if (!el.classList.contains('dark-theme')) {
            SetDarkMode();
        }
    }).observe(document.documentElement, {
        attributes: true,
        attributeFilter: ['class'],
        subtree: true
    });
})();