♻️ 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-light',
themeName: 'material-light',
dark: false,
// 基础色调
background: '#FAFAFA',
backgroundSecondary: '#f1faf1',
surface: '#FAFAFA',
dropdownBackground: '#FAFAFA',
dropdownBorder: '#00000010',
// 文本颜色
foreground: '#90A4AE',
foregroundSecondary: '#90A4AE',
comment: '#90A4AE',
// 语法高亮色 - 核心
keyword: '#7C4DFF',
string: '#91B859',
function: '#6182B8',
number: '#F76D47',
operator: '#7C4DFF',
variable: '#90A4AE',
type: '#8796B0',
// 语法高亮色 - 扩展
constant: '#F76D47',
storage: '#7C4DFF',
parameter: '#90A4AE',
class: '#FFB62C',
heading: '#91B859',
invalid: '#E53935',
regexp: '#39ADB5',
// 界面元素
cursor: '#272727',
selection: '#80CBC440',
selectionBlur: '#80CBC440',
activeLine: '#c2c2c222',
lineNumber: '#CFD8DC',
activeLineNumber: '#7E939E',
// 边框和分割线
borderColor: '#00000010',
borderLight: '#90A4AE19',
// 搜索和匹配
searchMatch: '#6182B8',
matchingBracket: '#FAFAFA',
}
// 使用通用主题工厂函数创建 Material Light 主题
export const materialLight: Extension = createBaseTheme(config)
background: '#fafafa',
backgroundSecondary: '#f1faf1',
surface: '#fafafa',
dropdownBackground: '#fafafa',
dropdownBorder: '#00000010',
foreground: '#90a4ae',
foregroundSecondary: '#7e939e',
cursor: '#272727',
selection: '#80cbc440',
selectionBlur: '#80cbc440',
activeLine: '#c2c2c222',
lineNumber: '#cfd8dc',
activeLineNumber: '#7e939e',
diffInserted: '#91b859',
diffDeleted: '#e53935',
diffChanged: '#ffcb6b',
borderColor: '#00000010',
borderLight: '#90a4ae19',
searchMatch: '#6182b8',
matchingBracket: '#fafafa',
comment: '#90a4ae',
lineComment: '#8598a3',
blockComment: '#788b97',
docComment: '#a3b6c1',
name: '#90a4ae',
variableName: '#90a4ae',
typeName: '#8796b0',
tagName: '#8ab0c7',
propertyName: '#bcccd5',
attributeName: '#ffb7c5',
className: '#ffb62c',
labelName: '#f78c6c',
namespace: '#61bcd2',
macroName: '#6182b8',
literal: '#f76d47',
string: '#91b859',
docString: '#a2cf6e',
character: '#cbe58f',
attributeValue: '#f7c493',
number: '#f76d47',
integer: '#f88760',
float: '#ff9a73',
bool: '#caa840',
regexp: '#39adb5',
escape: '#5ed1ce',
color: '#f4a35d',
url: '#4c91d6',
keyword: '#7c4dff',
self: '#9f77ff',
null: '#c9495f',
atom: '#f76d47',
unit: '#cf7a44',
modifier: '#a07ffe',
operatorKeyword: '#9c7bff',
controlKeyword: '#8a66ff',
definitionKeyword: '#a782ff',
moduleKeyword: '#6c89ff',
operator: '#7c4dff',
derefOperator: '#a07cfe',
arithmeticOperator: '#916dff',
logicOperator: '#9c74ff',
bitwiseOperator: '#7a5bdd',
compareOperator: '#8b64ef',
updateOperator: '#6f4ecf',
definitionOperator: '#6a4bc7',
typeOperator: '#5bbbd2',
controlOperator: '#6244b5',
punctuation: '#a2b3c0',
separator: '#94a3b0',
bracket: '#c2cad0',
angleBracket: '#dee5eb',
squareBracket: '#b8c1c7',
paren: '#a5aebb',
brace: '#bcc4ce',
content: '#90a4ae',
heading: '#91b859',
heading1: '#a5cf6c',
heading2: '#9bc261',
heading3: '#92b656',
heading4: '#89a94c',
heading5: '#809d41',
heading6: '#779136',
contentSeparator: '#7c4dff',
list: '#a6b4bb',
quote: '#7c8a91',
emphasis: '#90a4ae',
strong: '#3e4a52',
link: '#6182b8',
monospace: '#b7c4cc',
strikethrough: '#98a5ad',
inserted: '#91b859',
deleted: '#e53935',
changed: '#ffcb6b',
invalid: '#e53935',
meta: '#8ca0a9',
documentMeta: '#7e9099',
annotation: '#58d3e6',
processingInstruction: '#6d7e87',
definition: '#c7d2d6',
constant: '#f76d47',
function: '#6182b8',
standard: '#a5b2b8',
local: '#b3c0c7',
special: '#ffb62c',
};
export const materialLight: Extension = createBaseTheme(config);