♻️ 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: 'material-dark',
themeName: 'material-dark',
dark: true,
// 基础色调
background: '#263238',
backgroundSecondary: '#2D3E46FF',
backgroundSecondary: '#2d3e46',
surface: '#263238',
dropdownBackground: '#263238',
dropdownBorder: '#FFFFFF10',
// 文本颜色
foreground: '#EEFFFF',
foregroundSecondary: '#EEFFFF',
comment: '#546E7A',
// 语法高亮色 - 核心
keyword: '#C792EA',
string: '#C3E88D',
function: '#82AAFF',
number: '#F78C6C',
operator: '#C792EA',
variable: '#EEFFFF',
type: '#B2CCD6',
// 语法高亮色 - 扩展
constant: '#F78C6C',
storage: '#C792EA',
parameter: '#EEFFFF',
class: '#FFCB6B',
heading: '#C3E88D',
invalid: '#FF5370',
regexp: '#89DDFF',
// 界面元素
cursor: '#FFCC00',
selection: '#80CBC420',
selectionBlur: '#80CBC420',
activeLine: '#4c616c22',
lineNumber: '#37474F',
activeLineNumber: '#607a86',
// 边框和分割线
borderColor: '#FFFFFF10',
borderLight: '#EEFFFF19',
// 搜索和匹配
searchMatch: '#82AAFF',
matchingBracket: '#263238',
}
dropdownBorder: '#ffffff10',
// 使用通用主题工厂函数创建 Material Dark 主题
export const materialDark: Extension = createBaseTheme(config)
foreground: '#eeffff',
foregroundSecondary: '#9fbac2',
cursor: '#ffcc00',
selection: '#80cbc420',
selectionBlur: '#80cbc420',
activeLine: '#4c616c22',
lineNumber: '#37474f',
activeLineNumber: '#607a86',
diffInserted: '#c3e88d',
diffDeleted: '#ff5370',
diffChanged: '#ffcb6b',
borderColor: '#ffffff10',
borderLight: '#eeffff19',
searchMatch: '#82aaff',
matchingBracket: '#263238',
comment: '#546e7a',
lineComment: '#4b606a',
blockComment: '#455962',
docComment: '#6c8795',
name: '#eeffff',
variableName: '#eeffff',
typeName: '#b2ccd6',
tagName: '#9ad4f5',
propertyName: '#e0f2ff',
attributeName: '#ffdcdc',
className: '#ffcb6b',
labelName: '#ffd17a',
namespace: '#8ad2e7',
macroName: '#82aaff',
literal: '#f78c6c',
string: '#c3e88d',
docString: '#d3f8a8',
character: '#ffe8c0',
attributeValue: '#ffd99f',
number: '#f78c6c',
integer: '#ff996e',
float: '#ffad80',
bool: '#ffd37d',
regexp: '#89ddff',
escape: '#66d9ff',
color: '#ffd492',
url: '#72d1ff',
keyword: '#c792ea',
self: '#d29ef2',
null: '#ff8aad',
atom: '#f78c6c',
unit: '#f78c6c',
modifier: '#dca8f0',
operatorKeyword: '#ca8de3',
controlKeyword: '#c280e1',
definitionKeyword: '#ce95ea',
moduleKeyword: '#d8a8f0',
operator: '#c792ea',
derefOperator: '#d79ef4',
arithmeticOperator: '#d28aec',
logicOperator: '#cd84e3',
bitwiseOperator: '#c77cdf',
compareOperator: '#cc8fe5',
updateOperator: '#c47ad9',
definitionOperator: '#bb6fd0',
typeOperator: '#cfa2ed',
controlOperator: '#b767cf',
punctuation: '#d9b4ff',
separator: '#d5aef6',
bracket: '#9fb6c5',
angleBracket: '#c4ddff',
squareBracket: '#a7c5dd',
paren: '#adc3d4',
brace: '#92aabd',
content: '#eeffff',
heading: '#c3e88d',
heading1: '#aeea9c',
heading2: '#a0dd92',
heading3: '#92d087',
heading4: '#85c37d',
heading5: '#78b673',
heading6: '#6aa969',
contentSeparator: '#c792ea',
list: '#b7cad4',
quote: '#758892',
emphasis: '#eeffff',
strong: '#f8ffff',
link: '#89ddff',
monospace: '#d7e4ec',
strikethrough: '#b4c4cc',
inserted: '#c3e88d',
deleted: '#ff5370',
changed: '#ffcb6b',
invalid: '#ff5370',
meta: '#6d8795',
documentMeta: '#648292',
annotation: '#73e0ff',
processingInstruction: '#617480',
definition: '#d0dae4',
constant: '#f78c6c',
function: '#82aaff',
standard: '#bacdd8',
local: '#c3d3dc',
special: '#ffd8a6',
};
export const materialDark: Extension = createBaseTheme(config);