♻️ Refactor theme module

This commit is contained in:
2025-11-20 00:39:00 +08:00
parent 4471441d6f
commit 5584a46ca2
21 changed files with 1975 additions and 1126 deletions

View File

@@ -1,57 +1,117 @@
import {Extension} from '@codemirror/state'
import {createBaseTheme} from '../base'
import type {ThemeColors} from '../types'
import {Extension} from '@codemirror/state';
import {createBaseTheme} from '../base';
import type {ThemeColors} from '../types';
export const config: ThemeColors = {
name: 'solarized-light',
themeName: 'solarized-light',
dark: false,
// 基础色调
background: '#FDF6E3',
backgroundSecondary: '#FFEEBCD4',
surface: '#FDF6E3',
dropdownBackground: '#FDF6E3',
dropdownBorder: '#D3AF86',
// 文本颜色
foreground: '#586E75',
foregroundSecondary: '#586E75',
comment: '#93A1A1',
// 语法高亮色 - 核心
keyword: '#859900',
string: '#2AA198',
function: '#268BD2',
number: '#D33682',
operator: '#859900',
variable: '#268BD2',
type: '#CB4B16',
// 语法高亮色 - 扩展
constant: '#CB4B16',
storage: '#586E75',
parameter: '#268BD2',
class: '#CB4B16',
heading: '#268BD2',
invalid: '#DC322F',
regexp: '#DC322F',
// 界面元素
cursor: '#657B83',
selection: '#EEE8D5',
selectionBlur: '#EEE8D5',
activeLine: '#d5bd5c22',
lineNumber: '#586E75',
activeLineNumber: '#567983',
// 边框和分割线
borderColor: '#EEE8D5',
borderLight: '#586E7519',
// 搜索和匹配
searchMatch: '#268BD2',
matchingBracket: '#EEE8D5',
}
// 使用通用主题工厂函数创建 Solarized Light 主题
export const solarizedLight: Extension = createBaseTheme(config)
background: '#fdf6e3',
backgroundSecondary: '#ffeeccd4',
surface: '#fdf6e3',
dropdownBackground: '#fdf6e3',
dropdownBorder: '#d3af86',
foreground: '#586e75',
foregroundSecondary: '#93a1a1',
cursor: '#657b83',
selection: '#eee8d5',
selectionBlur: '#eee8d5',
activeLine: '#d5bd5c22',
lineNumber: '#586e75',
activeLineNumber: '#567983',
diffInserted: '#2aa198',
diffDeleted: '#dc322f',
diffChanged: '#b58900',
borderColor: '#eee8d5',
borderLight: '#586e7519',
searchMatch: '#268bd2',
matchingBracket: '#eee8d5',
comment: '#93a1a1',
lineComment: '#82939d',
blockComment: '#7a8b95',
docComment: '#a5b6be',
name: '#586e75',
variableName: '#268bd2',
typeName: '#cb4b16',
tagName: '#2cbeb1',
propertyName: '#b3baba',
attributeName: '#d4835a',
className: '#cb4b16',
labelName: '#c98c0d',
namespace: '#3bb3ae',
macroName: '#268bd2',
literal: '#d33682',
string: '#2aa198',
docString: '#23b1a2',
character: '#4bd2c7',
attributeValue: '#c09a53',
number: '#d33682',
integer: '#c74a78',
float: '#b93d6b',
bool: '#b58900',
regexp: '#2aa198',
escape: '#3ad1c5',
color: '#cb4b16',
url: '#268bd2',
keyword: '#859900',
self: '#97aa06',
null: '#bf5f00',
atom: '#cb4b16',
unit: '#a57300',
modifier: '#a1871e',
operatorKeyword: '#76860a',
controlKeyword: '#7d9509',
definitionKeyword: '#7ba600',
moduleKeyword: '#5e9d76',
operator: '#859900',
derefOperator: '#9daa22',
arithmeticOperator: '#8c9b19',
logicOperator: '#85a612',
bitwiseOperator: '#6a7e0a',
compareOperator: '#7da811',
updateOperator: '#63740a',
definitionOperator: '#5f6c08',
typeOperator: '#2aa198',
controlOperator: '#586e0b',
punctuation: '#9db3ae',
separator: '#8c9f96',
bracket: '#cad2c9',
angleBracket: '#e3e8e0',
squareBracket: '#b7bfb7',
paren: '#939c93',
brace: '#c2c9c1',
content: '#586e75',
heading: '#268bd2',
heading1: '#3fb7d4',
heading2: '#36abc8',
heading3: '#2d9fbc',
heading4: '#2493b0',
heading5: '#1b87a4',
heading6: '#127b98',
contentSeparator: '#859900',
list: '#a7a591',
quote: '#8f9b8e',
emphasis: '#586e75',
strong: '#657b83',
link: '#268bd2',
monospace: '#c8c2b4',
strikethrough: '#bab29d',
inserted: '#2aa198',
deleted: '#dc322f',
changed: '#b58900',
invalid: '#dc322f',
meta: '#7d8b8f',
documentMeta: '#758288',
annotation: '#3ab4c3',
processingInstruction: '#6a7377',
definition: '#bcc7c0',
constant: '#cb4b16',
function: '#268bd2',
standard: '#8da1a0',
local: '#9eb1ac',
special: '#b58900',
};
export const solarizedLight: Extension = createBaseTheme(config);