您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Set theme color based on Google Docs header's background color
// ==UserScript== // @name Google Docs blend webapp window decoration/theme color with header // @namespace https://greasyforks.org/users/1257389 // @version 1.0.00 // @description Set theme color based on Google Docs header's background color // @author dvirzxc // @match https://docs.google.com/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; function getBackgroundColor() { const selector = '[class*=docs-grille-]'; const elementClass = document.querySelector(selector); if (elementClass) { const element = elementClass.querySelector('#docs-chrome:not(.docs-hub-chrome)'); if (element) { const style = window.getComputedStyle(element); return style.backgroundColor; } } return '#ffffff'; // Return white when there's no selector to be found } // Function to set the meta tag function setChromeThemeColor(color) { const metaThemeColor = document.createElement('meta'); metaThemeColor.setAttribute('name', 'theme-color'); metaThemeColor.setAttribute('content', color); document.head.appendChild(metaThemeColor); } // Run const backgroundColor = getBackgroundColor(); setChromeThemeColor(backgroundColor); })();