// ==UserScript==
// @name Change ChatGPT DarkTheme
// @name:zh 更好的ChatGPT暗色主题
// @namespace http://tampermonkey.net/
// @version 2024-04-13
// @license MIT
// @author You
// @match https://chat.openai.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=openai.com
// @grant none
// @description 为ChatGPT设置更友好的暗色主题
// @run-at document-idle
// ==/UserScript==
(function() {
'use strict';
// Function to modify CSS variables for eye comfort
function modifyThemeColors() {
const rootStyle = document.documentElement.style;
// Modify text color variables
rootStyle.setProperty('--text-primary', '#ccd3f2', 'important');
rootStyle.setProperty('--text-secondary', '#c0c0c0', 'important');
rootStyle.setProperty('--text-tertiary', '#a9a9a9', 'important');
rootStyle.setProperty('--text-quaternary', '#808080', 'important');
// Modify border color variables
rootStyle.setProperty('--border-light', 'hsla(0, 0%, 100%, 0.05)', 'important');
rootStyle.setProperty('--border-medium', 'hsla(0, 0%, 100%, 0.1)', 'important');
rootStyle.setProperty('--border-heavy', 'hsla(0, 0%, 100%, 0.15)', 'important');
rootStyle.setProperty('--border-xheavy', 'hsla(0, 0%, 100%, 0.2)', 'important');
// Modify surface color variables
rootStyle.setProperty('--main-surface-primary', '#21232f', 'important');
rootStyle.setProperty('--main-surface-secondary', '#696969', 'important');
rootStyle.setProperty('--main-surface-tertiary', '#808080', 'important');
rootStyle.setProperty('--sidebar-surface-primary', '#2d2f41', 'important');
rootStyle.setProperty('--sidebar-surface-secondary', '#373a4d', 'important');
rootStyle.setProperty('--sidebar-surface-tertiary', '#696969', 'important');
// Modify link color variables
rootStyle.setProperty('--link', '#7ab7ff', 'important');
rootStyle.setProperty('--link-hover', '#5e83b3', 'important');
// Additional style modifications
const styleSheet = document.createElement('style');
document.head.appendChild(styleSheet);
styleSheet.sheet.insertRule(`.bg-gray-950 { --tw-bg-opacity: 0.5; background-color: rgba(13, 13, 13, var(--tw-bg-opacity)); }`, 0);
styleSheet.sheet.insertRule('.hljs-bullet, .hljs-link, .hljs-selector-id, .hljs-symbol, .hljs-title { color: #91acee; }', 0);
styleSheet.sheet.insertRule('.hljs-doctag, .hljs-formula, .hljs-keyword, .hljs-literal { color: #c0a1f0; }', 1);
styleSheet.sheet.insertRule('.hljs-addition, .hljs-attribute, .hljs-meta-string, .hljs-regexp, .hljs-string { color: #b1d99c; }', 2);
styleSheet.sheet.insertRule('.hljs-attr, .hljs-number, .hljs-selector-attr, .hljs-selector-class, .hljs-selector-pseudo, .hljs-template-variable, .hljs-type, .hljs-variable { color: #e29da1; }', 3);
styleSheet.sheet.insertRule(`.dark.dark\\:prose-invert { --text-primary: #ccd3f2 !important }`, 0);
}
// Call the function to modify theme colors after the page loads
window.addEventListener('load', modifyThemeColors);
})();