Twitter Dim Theme

Overrides "Lights Out" mode with Dim theme. Vibe coded with Gemini.

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        Twitter Dim Theme
// @namespace   Violentmonkey Scripts
// @match       https://twitter.com/*
// @match       https://x.com/*
// @grant       none
// @version     1.0
// @run-at      document-start
// @author      Gemini
// @description Overrides "Lights Out" mode with Dim theme. Vibe coded with Gemini.
// @license     GNU GPLv3
// ==/UserScript==

(function() {
    'use strict';

    const css = `
        :root {
            --dim-bg: rgb(21, 32, 43);
            --dim-backdrop: rgba(21, 32, 43, .85);
            --dim-border: rgb(56, 68, 77);
            --dim-text-dim: rgb(139, 152, 165);
            --dim-hover: rgba(30, 39, 50, 1);
        }

        /* Immediate Background Overrides */
        html, body, #react-root,
        [style*="background-color: rgb(0, 0, 0)"],
        [style*="background-color: #000000"],
        .r-kemksi {
            background-color: var(--dim-bg) !important;
        }

        /* Lights Out variable overrides */
        body.LightsOut {
            --border-color: var(--dim-border) !important;
            --color: var(--dim-text-dim) !important;
            --hover-bg-color: var(--dim-hover) !important;
        }

        /* Layout Elements: Backdrop, Borders, and Hovers */
        .r-5zmot { background-color: var(--dim-backdrop) !important; }
        .r-1kqtdi0, .r-1igl3o0, .r-2sztyj { border-color: var(--dim-border) !important; }
        .r-g2wdr4, .r-1hdo0pc, .r-cuuowz { background-color: var(--dim-hover) !important; }

        /* Typography and Shadows */
        .cpft_text, [style*="color: rgb(113, 118, 123);"] {
            color: var(--dim-text-dim) !important;
        }

        .r-qo02w8 {
            box-shadow: rgba(136, 153, 166, 0.2) 0px 0px 15px, rgba(136, 153, 166, 0.15) 0px 0px 3px 1px !important;
        }
    `;

    const injectStyles = () => {
        if (document.getElementById('gm-dim-theme')) return; // Don't double-inject
        
        const head = document.head || document.getElementsByTagName('head')[0];
        if (head) {
            const style = document.createElement('style');
            style.id = 'gm-dim-theme';
            style.textContent = css;
            head.appendChild(style);
        } else {
            // Check again on the next animation frame if head isn't ready
            requestAnimationFrame(injectStyles);
        }
    };

    injectStyles();
})();