|
| 1 | +import { tags as t } from '@lezer/highlight'; |
| 2 | +import { createTheme, CreateThemeOptions } from '@uiw/codemirror-themes'; |
| 3 | + |
| 4 | +export const tokyoNightDayInit = (options?: CreateThemeOptions) => { |
| 5 | + const { theme = 'light', settings = {}, styles = [] } = options || {}; |
| 6 | + return createTheme({ |
| 7 | + theme: theme, |
| 8 | + settings: { |
| 9 | + background: '#e1e2e7', |
| 10 | + foreground: '#3760bf', |
| 11 | + caret: '#3760bf', |
| 12 | + selection: '#99a7df', |
| 13 | + selectionMatch: '#99a7df', |
| 14 | + gutterBackground: '#e1e2e7', |
| 15 | + gutterForeground: '#3760bf', |
| 16 | + gutterBorder: 'transparent', |
| 17 | + lineHighlight: '#5f5faf11', |
| 18 | + ...settings, |
| 19 | + }, |
| 20 | + styles: [ |
| 21 | + { tag: t.keyword, color: '#007197' }, |
| 22 | + { tag: [t.name, t.deleted, t.character, t.macroName], color: '#3760bf' }, |
| 23 | + { tag: [t.propertyName], color: '#3760bf' }, |
| 24 | + { tag: [t.processingInstruction, t.string, t.inserted, t.special(t.string)], color: '#587539' }, |
| 25 | + { tag: [t.function(t.variableName), t.labelName], color: '#3760bf' }, |
| 26 | + { tag: [t.color, t.constant(t.name), t.standard(t.name)], color: '#3760bf' }, |
| 27 | + { tag: [t.definition(t.name), t.separator], color: '#3760bf' }, |
| 28 | + { tag: [t.className], color: '#3760bf' }, |
| 29 | + { tag: [t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace], color: '#b15c00' }, |
| 30 | + { tag: [t.typeName], color: '#007197', fontStyle: '#007197' }, |
| 31 | + { tag: [t.operator, t.operatorKeyword], color: '#007197' }, |
| 32 | + { tag: [t.url, t.escape, t.regexp, t.link], color: '#587539' }, |
| 33 | + { tag: [t.meta, t.comment], color: '#848cb5' }, |
| 34 | + { tag: t.strong, fontWeight: 'bold' }, |
| 35 | + { tag: t.emphasis, fontStyle: 'italic' }, |
| 36 | + { tag: t.link, textDecoration: 'underline' }, |
| 37 | + { tag: t.heading, fontWeight: 'bold', color: '#b15c00' }, |
| 38 | + { tag: [t.atom, t.bool, t.special(t.variableName)], color: '#3760bf' }, |
| 39 | + { tag: t.invalid, color: '#f52a65' }, |
| 40 | + { tag: t.strikethrough, textDecoration: 'line-through' }, |
| 41 | + ...styles, |
| 42 | + ], |
| 43 | + }); |
| 44 | +}; |
| 45 | + |
| 46 | +export const tokyoNightDay = tokyoNightDayInit(); |
0 commit comments