|
1 | 1 | import { tags as t } from '@lezer/highlight';
|
2 |
| -import { createTheme } from '@uiw/codemirror-themes'; |
| 2 | +import { createTheme, CreateThemeOptions } from '@uiw/codemirror-themes'; |
3 | 3 |
|
4 |
| -export const bbedit = createTheme({ |
5 |
| - theme: 'light', |
6 |
| - settings: { |
7 |
| - background: '#FFFFFF', |
8 |
| - foreground: '#000000', |
9 |
| - caret: '#FBAC52', |
10 |
| - selection: '#FFD420', |
11 |
| - selectionMatch: '#FFD420', |
12 |
| - gutterBackground: '#f5f5f5', |
13 |
| - gutterForeground: '#4D4D4C', |
14 |
| - lineHighlight: '#00000012', |
15 |
| - }, |
16 |
| - styles: [ |
17 |
| - { tag: [t.meta, t.comment], color: '#804000' }, |
18 |
| - { tag: [t.keyword, t.strong], color: '#0000FF' }, |
19 |
| - { tag: [t.number], color: '#FF0080' }, |
20 |
| - { tag: [t.string], color: '#FF0080' }, |
21 |
| - { tag: [t.variableName], color: '#006600' }, |
22 |
| - { tag: [t.escape], color: '#33CC33' }, |
23 |
| - { tag: [t.tagName], color: '#1C02FF' }, |
24 |
| - { tag: [t.heading], color: '#0C07FF' }, |
25 |
| - { tag: [t.quote], color: '#000000' }, |
26 |
| - { tag: [t.list], color: '#B90690' }, |
27 |
| - { tag: [t.documentMeta], color: '#888888' }, |
28 |
| - { tag: [t.function(t.variableName)], color: '#0000A2' }, |
29 |
| - { tag: [t.definition(t.typeName), t.typeName], color: '#6D79DE' }, |
30 |
| - ], |
31 |
| -}); |
| 4 | +export const bbeditInit = (options?: CreateThemeOptions) => { |
| 5 | + const { theme = 'light', settings = {}, styles = [] } = options || {}; |
| 6 | + return createTheme({ |
| 7 | + theme: theme, |
| 8 | + settings: { |
| 9 | + background: '#FFFFFF', |
| 10 | + foreground: '#000000', |
| 11 | + caret: '#FBAC52', |
| 12 | + selection: '#FFD420', |
| 13 | + selectionMatch: '#FFD420', |
| 14 | + gutterBackground: '#f5f5f5', |
| 15 | + gutterForeground: '#4D4D4C', |
| 16 | + lineHighlight: '#00000012', |
| 17 | + ...settings, |
| 18 | + }, |
| 19 | + styles: [ |
| 20 | + { tag: [t.meta, t.comment], color: '#804000' }, |
| 21 | + { tag: [t.keyword, t.strong], color: '#0000FF' }, |
| 22 | + { tag: [t.number], color: '#FF0080' }, |
| 23 | + { tag: [t.string], color: '#FF0080' }, |
| 24 | + { tag: [t.variableName], color: '#006600' }, |
| 25 | + { tag: [t.escape], color: '#33CC33' }, |
| 26 | + { tag: [t.tagName], color: '#1C02FF' }, |
| 27 | + { tag: [t.heading], color: '#0C07FF' }, |
| 28 | + { tag: [t.quote], color: '#000000' }, |
| 29 | + { tag: [t.list], color: '#B90690' }, |
| 30 | + { tag: [t.documentMeta], color: '#888888' }, |
| 31 | + { tag: [t.function(t.variableName)], color: '#0000A2' }, |
| 32 | + { tag: [t.definition(t.typeName), t.typeName], color: '#6D79DE' }, |
| 33 | + ...styles, |
| 34 | + ], |
| 35 | + }); |
| 36 | +}; |
| 37 | + |
| 38 | +export const bbedit = bbeditInit(); |
0 commit comments