Notion Custom Font

Change Notion Default Font

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Notion Custom Font
// @namespace   Violentmonkey Scripts
// @match       *://www.notion.so/*
// @grant       none
// @version     1.0
// @author      reonokiy
// @description Change Notion Default Font
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

   // 更改为想要的字体
    const sansSerifFont = 'ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Helvetica, "PingFang SC", "思源黑体", "Microsoft YaHei", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol"';
    const serifFont = ' Lyon-Text, Georgia, "Songti SC", "思源宋体", serif';
    const monoFont = ' iawriter-mono, Nitti, Menlo, Courier, "思源等宽", monospace';

    const style = document.createElement('style');
    style.textContent = `
        .notion-app-inner {
            font-family: ${sansSerifFont} !important;
        }

        .notion-app-inner [style*="serif"] {
            font-family: ${serifFont} !important;
        }

        .notion-app-inner [style*="monospace"] {
            font-family: ${monoFont} !important;
        }
    `;

    document.head.appendChild(style);

    const observer = new MutationObserver(() => {
        document.querySelectorAll('.notion-app-inner').forEach(el => {
            el.style.fontFamily = sansSerifFont;
        });
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });

})();