明亮,白底,黑字

页面保持明亮模式,(除标题外)将加粗文本恢复正常大小,白底黑字。

目前为 2025-03-28 提交的版本。查看 最新版本

// ==UserScript==
// @name         明亮,白底,黑字
// @namespace    https://gf.qytechs.cn/users/1171320
// @version      0.1
// @description  页面保持明亮模式,(除标题外)将加粗文本恢复正常大小,白底黑字。
// @author       yzcjd
// @author2     Lama AI 辅助
// @match        *://*/*
// @run-at       document-end
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // 确保选择明亮模式
    const setLightMode = () => {
        document.documentElement.style.filter = 'invert(0)';
        document.documentElement.style.backgroundColor = 'white';
    };

    // 将加粗文本恢复成正常颜色
    const normalizeBoldText = () => {
        const boldElements = document.querySelectorAll('b, strong');
        boldElements.forEach(element => {
            element.style.color = 'inherit';
            element.style.fontWeight = 'normal';
        });
    };

    // 将所有非标题文字的字体颜色改为黑色
    const setTextToBlack = () => {
        const allTextElements = document.querySelectorAll('p, span, li, div');
        allTextElements.forEach(element => {
            const computedStyle = window.getComputedStyle(element);
            if (!computedStyle.fontSize.includes('h1') &&
                !computedStyle.fontSize.includes('h2') &&
                !computedStyle.fontSize.includes('h3') &&
                !computedStyle.fontSize.includes('h4') &&
                !computedStyle.fontSize.includes('h5') &&
                !computedStyle.fontSize.includes('h6')) {
                element.style.color = 'black';
            }
        });
    };

    // 执行调整
    setLightMode();
    normalizeBoldText();
    setTextToBlack();
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址