Greasy Fork is available in English.

Twitter Dim Theme

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

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