|
4 | 4 | * https://codemirror.net/5/theme/abcdef.css
|
5 | 5 | */
|
6 | 6 | import { tags as t } from '@lezer/highlight';
|
7 |
| -import { createTheme } from '@uiw/codemirror-themes'; |
| 7 | +import { createTheme, CreateThemeOptions } from '@uiw/codemirror-themes'; |
8 | 8 |
|
9 |
| -export const abcdef = createTheme({ |
10 |
| - theme: 'dark', |
11 |
| - settings: { |
12 |
| - background: '#0f0f0f', |
13 |
| - foreground: '#defdef', |
14 |
| - caret: '#00FF00', |
15 |
| - selection: '#515151', |
16 |
| - selectionMatch: '#515151', |
17 |
| - gutterBackground: '#555', |
18 |
| - gutterForeground: '#FFFFFF', |
19 |
| - lineHighlight: '#314151', |
20 |
| - }, |
21 |
| - styles: [ |
22 |
| - { tag: t.keyword, color: 'darkgoldenrod', fontWeight: 'bold' }, |
23 |
| - { tag: t.atom, color: '#77F' }, |
24 |
| - { tag: t.comment, color: '#7a7b7c', fontStyle: 'italic' }, |
25 |
| - { tag: t.number, color: 'violet' }, |
26 |
| - { tag: t.definition(t.variableName), color: '#fffabc' }, |
27 |
| - { tag: t.variableName, color: '#abcdef' }, |
28 |
| - { tag: t.function(t.variableName), color: '#fffabc' }, |
29 |
| - { tag: t.typeName, color: '#FFDD44' }, |
30 |
| - { tag: t.tagName, color: '#def' }, |
31 |
| - { tag: t.string, color: '#2b4' }, |
32 |
| - { tag: t.meta, color: '#C9F' }, |
33 |
| - // { tag: t.qualifier, color: '#FFF700' }, |
34 |
| - // { tag: t.builtin, color: '#30aabc' }, |
35 |
| - { tag: t.bracket, color: '#8a8a8a' }, |
36 |
| - { tag: t.attributeName, color: '#DDFF00' }, |
37 |
| - { tag: t.heading, color: 'aquamarine', fontWeight: 'bold' }, |
38 |
| - { tag: t.link, color: 'blueviolet', fontWeight: 'bold' }, |
39 |
| - ], |
40 |
| -}); |
| 9 | +export const abcdefInit = (options?: CreateThemeOptions) => { |
| 10 | + const { theme = 'dark', settings = {}, styles = [] } = options || {}; |
| 11 | + return createTheme({ |
| 12 | + theme: theme, |
| 13 | + settings: { |
| 14 | + background: '#0f0f0f', |
| 15 | + foreground: '#defdef', |
| 16 | + caret: '#00FF00', |
| 17 | + selection: '#515151', |
| 18 | + selectionMatch: '#515151', |
| 19 | + gutterBackground: '#555', |
| 20 | + gutterForeground: '#FFFFFF', |
| 21 | + lineHighlight: '#314151', |
| 22 | + ...settings, |
| 23 | + }, |
| 24 | + styles: [ |
| 25 | + { tag: t.keyword, color: 'darkgoldenrod', fontWeight: 'bold' }, |
| 26 | + { tag: t.atom, color: '#77F' }, |
| 27 | + { tag: t.comment, color: '#7a7b7c', fontStyle: 'italic' }, |
| 28 | + { tag: t.number, color: 'violet' }, |
| 29 | + { tag: t.definition(t.variableName), color: '#fffabc' }, |
| 30 | + { tag: t.variableName, color: '#abcdef' }, |
| 31 | + { tag: t.function(t.variableName), color: '#fffabc' }, |
| 32 | + { tag: t.typeName, color: '#FFDD44' }, |
| 33 | + { tag: t.tagName, color: '#def' }, |
| 34 | + { tag: t.string, color: '#2b4' }, |
| 35 | + { tag: t.meta, color: '#C9F' }, |
| 36 | + // { tag: t.qualifier, color: '#FFF700' }, |
| 37 | + // { tag: t.builtin, color: '#30aabc' }, |
| 38 | + { tag: t.bracket, color: '#8a8a8a' }, |
| 39 | + { tag: t.attributeName, color: '#DDFF00' }, |
| 40 | + { tag: t.heading, color: 'aquamarine', fontWeight: 'bold' }, |
| 41 | + { tag: t.link, color: 'blueviolet', fontWeight: 'bold' }, |
| 42 | + ...styles, |
| 43 | + ], |
| 44 | + }); |
| 45 | +}; |
| 46 | + |
| 47 | +export const abcdef = abcdefInit(); |
0 commit comments