// ==UserScript== // @name Outline背景颜色修改 // @namespace http://tampermonkey.net/ // @version 2025-06-27 // @description // @author ClanEver // @match https://outline.eimsound.com/* // @icon https://minio.eimsound.com/outline/public/d4335404-a074-4741-a98c-05f7b4f013bd/4b90f268-826c-420f-80a9-34cad76922c5/Icon-1024.png // @updateURL https://gitea.tryanks.com/ClanEver/public-snippets/raw/branch/main/Outline背景颜色修改.user.js // @downloadURL https://gitea.tryanks.com/ClanEver/public-snippets/raw/branch/main/Outline背景颜色修改.user.js // @grant GM_registerMenuCommand // @grant GM_getValue // @grant GM_setValue // @run-at document-start // ==/UserScript== (function () { 'use strict'; const need_change_css_selector = [ '.heading-actions', // h1, h2, ...前的# '.byXfdg', // header '.cENRKu', // body '.VYaRH', // 标题 '.fTNybC', // 大纲 '.gAJGaK', // body '.hzusXH', // tab '.jyiNkt', // list '.eSXWfi', // tab '.grkcCz', // list ] const need_change_css_str = need_change_css_selector.join(',') const DEFAULT_COLOR = '#f7f8fa'; function getColor() { return GM_getValue('bgColor', DEFAULT_COLOR); } function setColor(color) { GM_setValue('bgColor', color); } // 注册菜单命令 GM_registerMenuCommand('设置背景颜色', () => { const current = getColor(); const newColor = prompt('请输入新的背景颜色(如 #ffffff 或 red):', current); if (newColor) { setColor(newColor); } }); const style = document.createElement('style'); style.innerHTML = ` ${need_change_css_str} { background-color: ${getColor()} !important; } `; document.documentElement.appendChild(style); //window.addEventListener('load', () => { // document.head.appendChild(style); //}); })();