// ==UserScript== // @name Bing Latte // @namespace custom-light-theme // @version 1.3.2 // @description Bing搜索浅色主题 // @tag bing 网页美化 // @author deran // @grant GM_addStyle // @run-at document-start // @license MIT // @match *://*.bing.com/search* // ==/UserScript== (function () { 'use strict'; /* ========== 色值定义 ========== */ const theme = { bg: '#eff1f5', // 页面背景 text: '#4c4f69', // 正文文字 selection: '#acb0be',// 选中文本高亮 link: '#1e66f5', // 链接色/聚焦高亮色 border: '#dce0e8', // 边框色 inputBg: '#ffffff', // 输入框背景 }; /* ========== 核心样式注入 ========== */ GM_addStyle(` /* 1. 页面主背景:仅作用于根容器与主内容区,不误伤搜索框 */ html, body, .b_page, #b_content, #b_header, .b_footer, .sw_card, .b_algo .b_caption, .b_pole { background-color: ${theme.bg} !important; background-image: none !important; } /* 2. 文本颜色统一 */ html, body, p, span, label, legend, caption, h1, h2, h3, h4, h5, h6, li, dd, dt, blockquote, cite, table, tr, td, th, thead, tbody { color: ${theme.text} !important; } /* 3. 文本选中高亮 */ ::selection { background-color: ${theme.selection} !important; color: ${theme.text} !important; } ::-moz-selection { background-color: ${theme.selection} !important; color: ${theme.text} !important; } /* 4. 链接颜色 */ a, a:link, a:visited { color: ${theme.link} !important; text-decoration: none; } a:hover, a:active { text-decoration: underline; } /* ========== 搜索框精准修复(核心) ========== */ /* 搜索框外层容器:视觉主体,保留原生圆角和阴影,仅适配色值 */ .b_searchboxForm, #sb_form_c { background-color: ${theme.inputBg} !important; border: 1px solid ${theme.border} !important; background-image: none !important; } /* 搜索框聚焦状态:用外层容器高亮,和原生交互逻辑一致 */ .b_searchboxForm:focus-within { border-color: ${theme.link} !important; box-shadow: 0 0 0 1px ${theme.link}20 !important; } /* 内层输入框:原生为透明背景,绝不强行加背景和边框 */ #sb_form_q { background-color: transparent !important; border: none !important; color: ${theme.text} !important; outline: none !important; } /* 搜索按钮、清除按钮、麦克风图标:保持透明背景,图标适配文字色 */ #sb_form_go, #sb_form_cl, .sb_search, .sb_clear, .b_searchboxSubmit, .b_searchboxClear, [id*="sb_form_"] svg, [class*="searchbox"] svg { background-color: transparent !important; fill: ${theme.text} !important; border: none !important; } /* 搜索建议下拉框适配 */ .sa_drw, .sa_sg { background-color: ${theme.inputBg} !important; border-color: ${theme.border} !important; } /* 6. 普通表单元素适配(排除搜索框相关元素) */ input:not([id*="sb_form_"]):not(.sb_*), textarea:not(#sb_form_q), select { background-color: ${theme.inputBg} !important; color: ${theme.text} !important; border: 1px solid ${theme.border} !important; outline: none; } input:focus, textarea:focus, select:focus { border-color: ${theme.link} !important; } /* 7. 边框柔和化(排除搜索框容器) */ .b_algo, .b_ans, .b_pag, .b_msg, table, tr, td, th, ul, ol, li, pre, code, blockquote { border-color: ${theme.border} !important; } /* 8. 媒体与图标保护 */ img, video, svg, canvas, picture, source, [class*="icon"], [class*="logo"], [style*="background-image"] { background-color: transparent !important; filter: none !important; } `); })();