|
6 | 6 | * Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
7 | 7 | */
|
8 | 8 | import { tags as t } from '@lezer/highlight';
|
9 |
| -import { createTheme } from '@uiw/codemirror-themes'; |
| 9 | +import { createTheme, CreateThemeOptions } from '@uiw/codemirror-themes'; |
10 | 10 |
|
11 |
| -export const bespin = createTheme({ |
12 |
| - theme: 'dark', |
13 |
| - settings: { |
14 |
| - background: '#28211c', |
15 |
| - foreground: '#9d9b97', |
16 |
| - caret: '#797977', |
17 |
| - selection: '#36312e', |
18 |
| - selectionMatch: '#4f382b', |
19 |
| - gutterBackground: '#28211c', |
20 |
| - gutterForeground: '#666666', |
21 |
| - lineHighlight: 'rgba(255, 255, 255, 0.1)', |
22 |
| - }, |
23 |
| - styles: [ |
24 |
| - { tag: [t.atom, t.number, t.link, t.bool], color: '#9b859d' }, |
25 |
| - { tag: t.comment, color: '#937121' }, |
26 |
| - { tag: [t.keyword, t.tagName], color: '#cf6a4c' }, |
27 |
| - { tag: t.string, color: '#f9ee98' }, |
28 |
| - { tag: t.bracket, color: '#9d9b97' }, |
29 |
| - { tag: [t.variableName], color: '#5ea6ea' }, |
30 |
| - { tag: t.definition(t.variableName), color: '#cf7d34' }, |
31 |
| - { tag: [t.function(t.variableName), t.className], color: '#cf7d34' }, |
32 |
| - { tag: [t.propertyName, t.attributeName], color: '#54be0d' }, |
33 |
| - ], |
34 |
| -}); |
| 11 | +export const bespinInit = (options?: CreateThemeOptions) => { |
| 12 | + const { theme = 'dark', settings = {}, styles = [] } = options || {}; |
| 13 | + return createTheme({ |
| 14 | + theme: theme, |
| 15 | + settings: { |
| 16 | + background: '#28211c', |
| 17 | + foreground: '#9d9b97', |
| 18 | + caret: '#797977', |
| 19 | + selection: '#36312e', |
| 20 | + selectionMatch: '#4f382b', |
| 21 | + gutterBackground: '#28211c', |
| 22 | + gutterForeground: '#666666', |
| 23 | + lineHighlight: 'rgba(255, 255, 255, 0.1)', |
| 24 | + ...settings, |
| 25 | + }, |
| 26 | + styles: [ |
| 27 | + { tag: [t.atom, t.number, t.link, t.bool], color: '#9b859d' }, |
| 28 | + { tag: t.comment, color: '#937121' }, |
| 29 | + { tag: [t.keyword, t.tagName], color: '#cf6a4c' }, |
| 30 | + { tag: t.string, color: '#f9ee98' }, |
| 31 | + { tag: t.bracket, color: '#9d9b97' }, |
| 32 | + { tag: [t.variableName], color: '#5ea6ea' }, |
| 33 | + { tag: t.definition(t.variableName), color: '#cf7d34' }, |
| 34 | + { tag: [t.function(t.variableName), t.className], color: '#cf7d34' }, |
| 35 | + { tag: [t.propertyName, t.attributeName], color: '#54be0d' }, |
| 36 | + ...styles, |
| 37 | + ], |
| 38 | + }); |
| 39 | +}; |
| 40 | + |
| 41 | +export const bespin = bespinInit(); |
0 commit comments