|
5 | 5 | * https://github.com/atom/one-dark-syntax
|
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 atomone = createTheme({ |
11 |
| - theme: 'dark', |
12 |
| - settings: { |
13 |
| - background: '#272C35', |
14 |
| - foreground: '#9d9b97', |
15 |
| - caret: '#797977', |
16 |
| - selection: '#ffffff30', |
17 |
| - selectionMatch: '#2B323D', |
18 |
| - gutterBackground: '#272C35', |
19 |
| - gutterForeground: '#465063', |
20 |
| - lineHighlight: '#2B323D', |
21 |
| - }, |
22 |
| - styles: [ |
23 |
| - { |
24 |
| - tag: [t.function(t.variableName), t.function(t.propertyName), t.url, t.processingInstruction], |
25 |
| - color: 'hsl(207, 82%, 66%)', |
| 10 | +export const atomoneInit = (options?: CreateThemeOptions) => { |
| 11 | + const { theme = 'light', settings = {}, styles = [] } = options || {}; |
| 12 | + return createTheme({ |
| 13 | + theme: theme, |
| 14 | + settings: { |
| 15 | + background: '#272C35', |
| 16 | + foreground: '#9d9b97', |
| 17 | + caret: '#797977', |
| 18 | + selection: '#ffffff30', |
| 19 | + selectionMatch: '#2B323D', |
| 20 | + gutterBackground: '#272C35', |
| 21 | + gutterForeground: '#465063', |
| 22 | + lineHighlight: '#2B323D', |
| 23 | + ...settings, |
26 | 24 | },
|
27 |
| - { tag: [t.tagName, t.heading], color: '#e06c75' }, |
28 |
| - { tag: t.comment, color: '#54636D' }, |
29 |
| - { tag: [t.propertyName], color: 'hsl(220, 14%, 71%)' }, |
30 |
| - { tag: [t.attributeName, t.number], color: 'hsl( 29, 54%, 61%)' }, |
31 |
| - { tag: t.className, color: 'hsl( 39, 67%, 69%)' }, |
32 |
| - { tag: t.keyword, color: 'hsl(286, 60%, 67%)' }, |
33 |
| - { tag: [t.string, t.regexp, t.special(t.propertyName)], color: '#98c379' }, |
34 |
| - ], |
35 |
| -}); |
| 25 | + styles: [ |
| 26 | + { |
| 27 | + tag: [t.function(t.variableName), t.function(t.propertyName), t.url, t.processingInstruction], |
| 28 | + color: 'hsl(207, 82%, 66%)', |
| 29 | + }, |
| 30 | + { tag: [t.tagName, t.heading], color: '#e06c75' }, |
| 31 | + { tag: t.comment, color: '#54636D' }, |
| 32 | + { tag: [t.propertyName], color: 'hsl(220, 14%, 71%)' }, |
| 33 | + { tag: [t.attributeName, t.number], color: 'hsl( 29, 54%, 61%)' }, |
| 34 | + { tag: t.className, color: 'hsl( 39, 67%, 69%)' }, |
| 35 | + { tag: t.keyword, color: 'hsl(286, 60%, 67%)' }, |
| 36 | + { tag: [t.string, t.regexp, t.special(t.propertyName)], color: '#98c379' }, |
| 37 | + ...styles, |
| 38 | + ], |
| 39 | + }); |
| 40 | +}; |
| 41 | + |
| 42 | +export const atomone = atomoneInit(); |
0 commit comments