|
5 | 5 | * From IntelliJ IDEA by JetBrains
|
6 | 6 | */
|
7 | 7 | import { tags as t } from '@lezer/highlight';
|
8 |
| -import { createTheme } from '@uiw/codemirror-themes'; |
| 8 | +import { createTheme, CreateThemeOptions } from '@uiw/codemirror-themes'; |
9 | 9 |
|
10 |
| -export const darcula = createTheme({ |
11 |
| - theme: 'dark', |
12 |
| - settings: { |
13 |
| - background: '#2B2B2B', |
14 |
| - foreground: '#f8f8f2', |
15 |
| - caret: '#FFFFFF', |
16 |
| - selection: 'rgba(255, 255, 255, 0.1)', |
17 |
| - selectionMatch: 'rgba(255, 255, 255, 0.2)', |
18 |
| - gutterBackground: 'rgba(255, 255, 255, 0.1)', |
19 |
| - gutterForeground: '#999', |
20 |
| - lineHighlight: 'rgba(255, 255, 255, 0.1)', |
21 |
| - }, |
22 |
| - styles: [ |
23 |
| - { tag: [t.atom, t.number], color: '#bd93f9' }, |
24 |
| - { tag: [t.comment], color: '#61A151' }, |
25 |
| - { tag: [t.string], color: '#6A8759' }, |
26 |
| - { tag: [t.variableName, t.operator], color: '#A9B7C6' }, |
27 |
| - { tag: [t.meta, t.className], color: '#A9B7C6' }, |
28 |
| - { tag: [t.propertyName], color: '#FFC66D' }, |
29 |
| - { tag: [t.keyword], color: '#CC7832' }, |
30 |
| - { tag: [t.tagName], color: '#ff79c6' }, |
31 |
| - { tag: [t.typeName], color: '#ffb86c' }, |
32 |
| - ], |
33 |
| -}); |
| 10 | +export const darculaInit = (options?: CreateThemeOptions) => { |
| 11 | + const { theme = 'light', settings = {}, styles = [] } = options || {}; |
| 12 | + return createTheme({ |
| 13 | + theme: theme, |
| 14 | + settings: { |
| 15 | + background: '#2B2B2B', |
| 16 | + foreground: '#f8f8f2', |
| 17 | + caret: '#FFFFFF', |
| 18 | + selection: 'rgba(255, 255, 255, 0.1)', |
| 19 | + selectionMatch: 'rgba(255, 255, 255, 0.2)', |
| 20 | + gutterBackground: 'rgba(255, 255, 255, 0.1)', |
| 21 | + gutterForeground: '#999', |
| 22 | + lineHighlight: 'rgba(255, 255, 255, 0.1)', |
| 23 | + ...settings, |
| 24 | + }, |
| 25 | + styles: [ |
| 26 | + { tag: [t.atom, t.number], color: '#bd93f9' }, |
| 27 | + { tag: [t.comment], color: '#61A151' }, |
| 28 | + { tag: [t.string], color: '#6A8759' }, |
| 29 | + { tag: [t.variableName, t.operator], color: '#A9B7C6' }, |
| 30 | + { tag: [t.meta, t.className], color: '#A9B7C6' }, |
| 31 | + { tag: [t.propertyName], color: '#FFC66D' }, |
| 32 | + { tag: [t.keyword], color: '#CC7832' }, |
| 33 | + { tag: [t.tagName], color: '#ff79c6' }, |
| 34 | + { tag: [t.typeName], color: '#ffb86c' }, |
| 35 | + ...styles, |
| 36 | + ], |
| 37 | + }); |
| 38 | +}; |
| 39 | + |
| 40 | +export const darcula = darculaInit(); |
0 commit comments