1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| // 深色模式适配样式,注入到保存的 HTML 中,跟随系统色自动切换 const darkModeStyle = `<style> @media (prefers-color-scheme: dark) { body { background-color: #1e1e1e !important; color: #d4d4d4 !important; } p, span, li, td, th, h1, h2, h3, h4, h5, h6, div, blockquote, a { color: inherit !important; } [style*="background-color"] { background-color: transparent !important; } [style*="color: rgb(0, 0, 0)"], [style*="color: #000"], [style*="color:#000"], [style*="color: rgb(51, 51, 51)"], [style*="color: #333"], [style*="color:#333"] { color: #d4d4d4 !important; } table { border-color: #444 !important; } td, th { border-color: #444 !important; } th { background-color: #2d2d2d !important; color: #d4d4d4 !important; } blockquote { background-color: #2d2d2d !important; border-left-color: #264f78 !important; color: #d4d4d4 !important; } pre, code { background-color: #2d2d2d !important; color: #d4d4d4 !important; border-color: #444 !important; } img { opacity: 0.85; filter: brightness(0.9) contrast(1.1); } hr { background-color: #444 !important; } } </style>`;
|