Greasy Fork is available in English.

Zhihu.com Dark Mode

Enable Zhihu.com Dark Mode

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name                Zhihu.com Dark Mode
// @name:zh-CN          知乎黑暗模式
// @name:zh-TW          知乎黑暗模式
// @namespace           https://www.zhihu.com/
// @version             0.7
// @description         Enable Zhihu.com Dark Mode
// @description:zh-CN   开启知乎黑暗模式
// @description:zh-TW   开启知乎黑暗模式
// @author              老蛤
// @match               *://*.zhihu.com/*
// @license             MIT
// ==/UserScript==


(function() {
    'use strict';

    const ignoreList = [
        'link.zhihu.com',
        'video.zhihu.com',
        'www.zhihu.com/pub/book',
        'www.zhihu.com/tardis',
    ];

    const checkURL = (url) => {
        for (const u of ignoreList) {
            if (url.indexOf(u) !== -1) {
                return false
            }
        }
        return true;
    };

    if (checkURL(location.href) && document.querySelector('html').getAttribute('data-theme') !== 'dark') {
        const url = new URL(location.href);
        const params = new URLSearchParams(url.search);
        params.set('theme', 'dark');
        url.search = params.toLocaleString();
        location.href = url.href;
    }
})();