CodeFaster

CodeFaster

Hackernews Darkmode

Tyler Adams's avatar
Tyler Adams
Jul 30, 2024
∙ Paid
Share

Courtesy of https://github.com/susam/userscripts and thanks to chatgpt for fixing the flashing issue

Install this custom script with TamperMonkey.

// ==UserScript==
// @name         Dark HN
// @match        https://news.ycombinator.com/*
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Create a style element
    const style = document.createElement('style');
    style.innerHTML = `
        body {
            background: #111 !important;
            filter: saturate(0) invert(1) hue-rotate(180deg) !important;
        }
        td {
            background: #ccc !important;
        }
        img {
            filter: saturate(0) !important;
        }
    `;

    // Append the style element to the head
    const head = document.head || document.getElementsByTagName('head')[0];
    if (head) {
        head.appendChild(style);
    } else {
        // If the head element is not available yet, use a MutationObserver to wait for it…

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 Tyler Adams
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture