|
|
@@ -6,45 +6,61 @@
|
|
|
import { createTheme, tags as t } from '@flowgram.ai/coze-editor/preset-code';
|
|
|
import { type Extension } from '@codemirror/state';
|
|
|
|
|
|
-const colors = {
|
|
|
- background: '#FFFFFF',
|
|
|
- comment: '#6B7280',
|
|
|
- key: '#2563EB',
|
|
|
- variable: '#DC2626',
|
|
|
- string: '#059669',
|
|
|
- number: '#EA580C',
|
|
|
- boolean: '#7C3AED',
|
|
|
- null: '#7C3AED',
|
|
|
- separator: '#374151',
|
|
|
+export const colors = {
|
|
|
+ background: '#f4f5f5',
|
|
|
+ foreground: '#444d56',
|
|
|
+ selection: '#0366d625',
|
|
|
+ cursor: '#044289',
|
|
|
+ dropdownBackground: '#fff',
|
|
|
+ dropdownBorder: '#e1e4e8',
|
|
|
+ activeLine: '#c6c6c622',
|
|
|
+ matchingBracket: '#34d05840',
|
|
|
+ keyword: '#d73a49',
|
|
|
+ storage: '#d73a49',
|
|
|
+ variable: '#e36209',
|
|
|
+ parameter: '#24292e',
|
|
|
+ function: '#005cc5',
|
|
|
+ string: '#032f62',
|
|
|
+ constant: '#005cc5',
|
|
|
+ type: '#005cc5',
|
|
|
+ class: '#6f42c1',
|
|
|
+ number: '#005cc5',
|
|
|
+ comment: '#6a737d',
|
|
|
+ heading: '#005cc5',
|
|
|
+ invalid: '#cb2431',
|
|
|
+ regexp: '#032f62',
|
|
|
};
|
|
|
|
|
|
export const lightTheme: Extension = createTheme({
|
|
|
variant: 'light',
|
|
|
settings: {
|
|
|
- background: '#FFFFFF',
|
|
|
- foreground: '#1F2937',
|
|
|
- caret: '#2563EB',
|
|
|
- selection: '#E5E7EB',
|
|
|
- gutterBackground: '#F9FAFB',
|
|
|
- gutterForeground: '#6B7280',
|
|
|
+ background: colors.background,
|
|
|
+ foreground: colors.foreground,
|
|
|
+ caret: colors.cursor,
|
|
|
+ selection: colors.selection,
|
|
|
+ gutterBackground: colors.background,
|
|
|
+ gutterForeground: colors.foreground,
|
|
|
gutterBorderColor: 'transparent',
|
|
|
gutterBorderWidth: 0,
|
|
|
- lineHighlight: '#F3F4F680',
|
|
|
+ lineHighlight: colors.background,
|
|
|
bracketColors: ['#F59E0B', '#8B5CF6', '#06B6D4'],
|
|
|
tooltip: {
|
|
|
- backgroundColor: '#FFFFFF',
|
|
|
- color: '#1F2937',
|
|
|
- border: '1px solid #E5E7EB',
|
|
|
- boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',
|
|
|
+ backgroundColor: colors.dropdownBackground,
|
|
|
+ color: colors.foreground,
|
|
|
+ border: 'none',
|
|
|
+ boxShadow: '0 0 1px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .1)!important',
|
|
|
+ maxWidth: '400px',
|
|
|
},
|
|
|
link: {
|
|
|
color: '#2563EB',
|
|
|
+ caret: colors.cursor,
|
|
|
},
|
|
|
completionItemHover: {
|
|
|
backgroundColor: '#F3F4F6',
|
|
|
},
|
|
|
completionItemSelected: {
|
|
|
- backgroundColor: '#E5E7EB',
|
|
|
+ backgroundColor: colors.selection,
|
|
|
+ color: colors.foreground,
|
|
|
},
|
|
|
completionItemIcon: {
|
|
|
color: '#4B5563',
|
|
|
@@ -60,84 +76,37 @@ export const lightTheme: Extension = createTheme({
|
|
|
},
|
|
|
},
|
|
|
styles: [
|
|
|
- // JSON
|
|
|
- {
|
|
|
- tag: t.comment,
|
|
|
- color: colors.comment,
|
|
|
- },
|
|
|
- {
|
|
|
- tag: [t.propertyName],
|
|
|
- color: colors.key,
|
|
|
- },
|
|
|
+ { tag: t.keyword, color: colors.keyword },
|
|
|
{
|
|
|
- tag: [t.variableName],
|
|
|
+ tag: [t.name, t.deleted, t.character, t.macroName],
|
|
|
color: colors.variable,
|
|
|
},
|
|
|
-
|
|
|
+ { tag: [t.propertyName], color: colors.function },
|
|
|
{
|
|
|
- tag: [t.string],
|
|
|
+ tag: [t.processingInstruction, t.string, t.inserted, t.special(t.string)],
|
|
|
color: colors.string,
|
|
|
},
|
|
|
+ { tag: [t.function(t.variableName), t.labelName], color: colors.function },
|
|
|
{
|
|
|
- tag: [t.number],
|
|
|
- color: colors.number,
|
|
|
- },
|
|
|
- {
|
|
|
- tag: [t.bool],
|
|
|
- color: colors.boolean,
|
|
|
- },
|
|
|
- {
|
|
|
- tag: [t.null],
|
|
|
- color: colors.null,
|
|
|
- },
|
|
|
- {
|
|
|
- tag: [t.separator],
|
|
|
- color: colors.separator,
|
|
|
- },
|
|
|
-
|
|
|
- // markdown
|
|
|
- {
|
|
|
- tag: [t.heading],
|
|
|
- color: '#2563EB',
|
|
|
- },
|
|
|
- {
|
|
|
- tag: [t.processingInstruction],
|
|
|
- color: '#2563EB',
|
|
|
- },
|
|
|
-
|
|
|
- // js
|
|
|
- {
|
|
|
- tag: [t.definitionKeyword],
|
|
|
- color: '#9333EA',
|
|
|
- },
|
|
|
- {
|
|
|
- tag: [t.modifier],
|
|
|
- color: '#9333EA',
|
|
|
- },
|
|
|
- {
|
|
|
- tag: [t.controlKeyword],
|
|
|
- color: '#9333EA',
|
|
|
+ tag: [t.color, t.constant(t.name), t.standard(t.name)],
|
|
|
+ color: colors.constant,
|
|
|
},
|
|
|
+ { tag: [t.definition(t.name), t.separator], color: colors.variable },
|
|
|
+ { tag: [t.className], color: colors.class },
|
|
|
{
|
|
|
- tag: [t.operatorKeyword],
|
|
|
- color: '#9333EA',
|
|
|
- },
|
|
|
-
|
|
|
- // shell
|
|
|
- // curl
|
|
|
- {
|
|
|
- tag: [t.standard(t.variableName)],
|
|
|
- color: '#059669',
|
|
|
- },
|
|
|
- // -X
|
|
|
- {
|
|
|
- tag: [t.attributeName],
|
|
|
- color: '#EA580C',
|
|
|
- },
|
|
|
- // url in string (includes quotes), e.g. "https://..."
|
|
|
- {
|
|
|
- tag: [t.special(t.string)],
|
|
|
- color: '#2563EB',
|
|
|
+ tag: [t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace],
|
|
|
+ color: colors.number,
|
|
|
},
|
|
|
+ { tag: [t.typeName], color: colors.type, fontStyle: colors.type },
|
|
|
+ { tag: [t.operator, t.operatorKeyword], color: colors.keyword },
|
|
|
+ { tag: [t.url, t.escape, t.regexp, t.link], color: colors.regexp },
|
|
|
+ { tag: [t.meta, t.comment], color: colors.comment },
|
|
|
+ { tag: t.strong, fontWeight: 'bold' },
|
|
|
+ { tag: t.emphasis, fontStyle: 'italic' },
|
|
|
+ { tag: t.link, textDecoration: 'underline' },
|
|
|
+ { tag: t.heading, fontWeight: 'bold', color: colors.heading },
|
|
|
+ { tag: [t.atom, t.bool, t.special(t.variableName)], color: colors.variable },
|
|
|
+ { tag: t.invalid, color: colors.invalid },
|
|
|
+ { tag: t.strikethrough, textDecoration: 'line-through' },
|
|
|
],
|
|
|
});
|