干货 软件 Rules & Tips
1. 遵守中国大陆相关法律法规
2. 严禁发布盗版软件
3. 严禁传播破解方法或工具
4. 严禁发布甩链接的下载信息
5. 提倡分享亲测好用的软件
6. 名称、版本、平台是必要信息

[Windows] 油猴脚本--视觉模式--衬线字体和纸墨模式 更新

查看: 4267|回复: 3
Curllen 发表于 2023-2-16 11:40:48
修改超链接等白色标签显示问题


食用方式: 自己建立一个新脚本
// ==UserScript==
// @name            视觉模式--衬线字体和纸墨模式
// @name:zh-CN      视觉模式--衬线字体和纸墨模式
// @name:en         EyesCareMode
// @version         0.1
// @description     视觉--衬线字体和纸墨模式
// @description:en  Easy EyesCare Mode, Reduce luminance for 10%
// @author          RunningCheese
// @namespace       https://www.runningcheese.com
// @license         MIT
// @match           *://*/*
// @icon            data:image/svg+xml,%3Csvg xmlns="http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"%3E%3Cpath fill="currentColor" d="M12 21q-1.65 0-2.825-1.175Q8 18.65 8 17H5q-.825 0-1.413-.587Q3 15.825 3 15q0-3.5 2.3-6.037Q7.6 6.425 11 6.05V3h2v3.05q3.4.375 5.7 2.913Q21 11.5 21 15q0 .825-.587 1.413Q19.825 17 19 17h-3q0 1.65-1.175 2.825Q13.65 21 12 21Zm-7-6h14q0-2.9-2.05-4.95Q14.9 8 12 8q-2.9 0-4.95 2.05Q5 12.1 5 15Zm7 4q.825 0 1.413-.587Q14 17.825 14 17h-4q0 .825.588 1.413Q11.175 19 12 19Zm0-2Z"%2F%3E%3C%2Fsvg%3E
// ==/UserScript==

    (function() {
    var i, c, color,aNum;
    var s = (document.getElementsByTagName('head')[0] || document.body).appendChild(document.createElement('style'));
    var t = document.createTextNode('p, div, font, blockquote { font-family: "PT Serif", Georgia, serif !important; }');
    s.appendChild(t);
    aNum = document.querySelectorAll('*') //获取所有类型的标签
    for(i = 0;i<aNum.length;i++){
        c = window.getComputedStyle(aNum,null);
        c=c.color.replace(/\s*/g,""); // 去除空格
        if(c=='rgb(255,255,255)'||c=='#fff'||c=='white'){
           aNum.style.color = '#000'
        }
   }
})();

    (function() {
    function getRGBColor(node, prop) {
        var rgb = getComputedStyle(node, null).getPropertyValue(prop);
        var r, g, b;
        if (/rgb\((\d+),\s(\d+),\s(\d+)\)/.exec(rgb)) {
            r = parseInt(RegExp.$1, 10);
            g = parseInt(RegExp.$2, 10);
            b = parseInt(RegExp.$3, 10);
            return [r / 255, g / 255, b / 255];
        }
        return rgb;
    }
    R(document.documentElement);

    function R(n) {
        var i, x, color,aNum,c,sNum;
        if (n.nodeType == Node.ELEMENT_NODE && n.tagName.toLowerCase() != 'input' && n.tagName.toLowerCase() != 'select' && n.tagName.toLowerCase != 'textarea') {
            for (i = 0; x = n.childNodes; ++i) R(x);
            color = getRGBColor(n, 'background-color');
            if ((typeof(color) != 'string' && color[0] + color[1] + color[2] >= 1) || (n == document.documentElement && color == 'transparent')) {
                n.style.backgroundColor = '#EDEBE8';
                n.style.setProperty('background-color', '#EDEBE8', 'important');
            }
        }
    }
})();
江楼烟雨 发表于 2023-2-16 12:04:41
怎么用教教小白, 成果展示图片放一个
123wangkou 发表于 2023-2-16 12:36:02
代码复制保存后好像只有衬线字体起作用,纸墨模式没起作用
 楼主| Curllen 发表于 2023-2-16 13:39:31
江楼烟雨 发表于 2023-2-16 12:04
怎么用教教小白, 成果展示图片放一个

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

虫部落 陕ICP备14001577号-1川公网安备 51019002003015号联系我们FAQ关于虫部落免责声明虫部落生存法则社区广场RSS

Build with for "make search easier" Copyright © 2013-2025. Powered by Discuz! GMT+8, 2025-5-12 07:13

快速回复 返回顶部 返回列表