您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Convert white backgrounds to dark mode and black text to a different color on Phitron.io
// ==UserScript== // @name Phitron Dark Mode // @namespace http://tampermonkey.net/ // @version 1.2 // @license MIT // @description Convert white backgrounds to dark mode and black text to a different color on Phitron.io // @author Your Name // @match https://phitron.io/* // @grant none // ==/UserScript== (function() { 'use strict'; function replaceColors() { const elements = document.querySelectorAll('*'); elements.forEach(element => { const bgColor = window.getComputedStyle(element).backgroundColor; if (bgColor && bgColor.toLowerCase() === 'rgb(255, 255, 255)') { element.style.backgroundColor = '#212121'; } const textColor = window.getComputedStyle(element).color; if (textColor && (isBlackish(textColor) || textColor.toLowerCase() === 'rgb(56, 56, 46)')) { element.style.color = '#2E95D3'; } }); } function isBlackish(color) { const [r, g, b] = color.match(/\d+/g).map(Number); return r < 50 && g < 50 && b < 50; } // Replace white background color and invert black text color replaceColors(); // Observe DOM changes and apply changes dynamically const observer = new MutationObserver(mutations => { mutations.forEach(mutation => { replaceColors(); }); }); observer.observe(document.body, { subtree: true, childList: true }); })();