♻️ 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: 'dracula',
themeName: 'dracula',
dark: true,
// 基础色调
background: '#282A36',
backgroundSecondary: '#323543FF',
surface: '#282A36',
dropdownBackground: '#282A36',
dropdownBorder: '#191A21',
// 文本颜色
foreground: '#F8F8F2',
foregroundSecondary: '#F8F8F2',
comment: '#6272A4',
// 语法高亮色 - 核心
keyword: '#FF79C6',
string: '#F1FA8C',
function: '#50FA7B',
number: '#BD93F9',
operator: '#FF79C6',
variable: '#F8F8F2',
type: '#8BE9FD',
// 语法高亮色 - 扩展
constant: '#BD93F9',
storage: '#FF79C6',
parameter: '#F8F8F2',
class: '#8BE9FD',
heading: '#BD93F9',
invalid: '#FF5555',
regexp: '#F1FA8C',
// 界面元素
cursor: '#F8F8F2',
selection: '#44475A',
selectionBlur: '#44475A',
activeLine: '#53576c22',
lineNumber: '#6272A4',
activeLineNumber: '#F8F8F2',
// 边框和分割线
borderColor: '#191A21',
borderLight: '#F8F8F219',
// 搜索和匹配
searchMatch: '#50FA7B',
matchingBracket: '#44475A',
}
// 使用通用主题工厂函数创建 Dracula 主题
export const dracula: Extension = createBaseTheme(config)
background: '#282a36',
backgroundSecondary: '#323543',
surface: '#282a36',
dropdownBackground: '#282a36',
dropdownBorder: '#191a21',
foreground: '#f8f8f2',
foregroundSecondary: '#cfcfc9',
cursor: '#f8f8f2',
selection: '#44475a',
selectionBlur: '#44475a',
activeLine: '#53576c22',
lineNumber: '#6272a4',
activeLineNumber: '#f8f8f2',
diffInserted: '#50fa7b',
diffDeleted: '#ff5555',
diffChanged: '#f1fa8c',
borderColor: '#191a21',
borderLight: '#f8f8f219',
searchMatch: '#50fa7b',
matchingBracket: '#44475a',
comment: '#6272a4',
lineComment: '#55608c',
blockComment: '#4f597f',
docComment: '#7c89bd',
name: '#f8f8f2',
variableName: '#f8f8f2',
typeName: '#8be9fd',
tagName: '#7de5ff',
propertyName: '#dcdce5',
attributeName: '#fcb5ff',
className: '#9cecff',
labelName: '#ffb86c',
namespace: '#6deeff',
macroName: '#50fa7b',
literal: '#bd93f9',
string: '#f1fa8c',
docString: '#f5ffa9',
character: '#ffec99',
attributeValue: '#ffcf99',
number: '#bd93f9',
integer: '#cfa6ff',
float: '#b48cff',
bool: '#ffb38b',
regexp: '#f1fa8c',
escape: '#f7ffae',
color: '#ffcf99',
url: '#8ae8ff',
keyword: '#ff79c6',
self: '#ff9dd7',
null: '#ff8fb0',
atom: '#bd93f9',
unit: '#bd93f9',
modifier: '#ff90d4',
operatorKeyword: '#ff8bd2',
controlKeyword: '#ff7dc1',
definitionKeyword: '#ff91d1',
moduleKeyword: '#ffacd9',
operator: '#ff79c6',
derefOperator: '#ff91d1',
arithmeticOperator: '#ff88c5',
logicOperator: '#ff8bcf',
bitwiseOperator: '#ff74ba',
compareOperator: '#ff86c6',
updateOperator: '#ff7cbf',
definitionOperator: '#ff6aae',
typeOperator: '#ff98d9',
controlOperator: '#ff6aa6',
punctuation: '#f4ade4',
separator: '#f3a6dc',
bracket: '#cfaefc',
angleBracket: '#ffcff1',
squareBracket: '#ff9fcc',
paren: '#ffb1d8',
brace: '#ff90c1',
content: '#f8f8f2',
heading: '#bd93f9',
heading1: '#d2b3ff',
heading2: '#c7a8ff',
heading3: '#bb9dff',
heading4: '#af92ff',
heading5: '#a387ff',
heading6: '#977cff',
contentSeparator: '#ff79c6',
list: '#c8cbd1',
quote: '#7b86a7',
emphasis: '#f8f8f2',
strong: '#ffffff',
link: '#8be9fd',
monospace: '#dadfde',
strikethrough: '#c2c8d1',
inserted: '#50fa7b',
deleted: '#ff5555',
changed: '#f1fa8c',
invalid: '#ff5555',
meta: '#8791bb',
documentMeta: '#7b84aa',
annotation: '#a7f7d4',
processingInstruction: '#6c7699',
definition: '#d6d9f2',
constant: '#bd93f9',
function: '#50fa7b',
standard: '#bac4d8',
local: '#c3c8da',
special: '#ffd6a5',
};
export const dracula: Extension = createBaseTheme(config);