Twitter Dim Theme

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

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==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();
})();