|
1 |
| -import { tags as t } from '@lezer/highlight'; |
2 |
| -import { createTheme, CreateThemeOptions } from '@uiw/codemirror-themes'; |
3 |
| - |
4 |
| -export const defaultSettingsSolarizedLight: CreateThemeOptions['settings'] = { |
5 |
| - background: '#fdf6e3', |
6 |
| - foreground: '#657b83', |
7 |
| - caret: '#586e75', |
8 |
| - selection: '#dfd9c8', |
9 |
| - selectionMatch: '#dfd9c8', |
10 |
| - gutterBackground: '#00000010', |
11 |
| - gutterForeground: '#657b83', |
12 |
| - lineHighlight: '#dfd9c8', |
13 |
| -}; |
14 |
| - |
15 |
| -export const solarizedLightInit = (options?: Partial<CreateThemeOptions>) => { |
16 |
| - const { theme = 'light', settings = {}, styles = [] } = options || {}; |
17 |
| - return createTheme({ |
18 |
| - theme: theme, |
19 |
| - settings: { |
20 |
| - ...defaultSettingsSolarizedLight, |
21 |
| - ...settings, |
22 |
| - }, |
23 |
| - styles: [ |
24 |
| - { tag: t.keyword, color: '#859900' }, |
25 |
| - { |
26 |
| - tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName], |
27 |
| - color: '#2aa198', |
28 |
| - }, |
29 |
| - { tag: [t.variableName], color: '#268bd2' }, |
30 |
| - { tag: [t.function(t.variableName)], color: '#268bd2' }, |
31 |
| - { tag: [t.labelName], color: '#d33682' }, |
32 |
| - { |
33 |
| - tag: [t.color, t.constant(t.name), t.standard(t.name)], |
34 |
| - color: '#b58900', |
35 |
| - }, |
36 |
| - { tag: [t.definition(t.name), t.separator], color: '#2aa198' }, |
37 |
| - { tag: [t.brace], color: '#d33682' }, |
38 |
| - { |
39 |
| - tag: [t.annotation], |
40 |
| - color: '#d30102', |
41 |
| - }, |
42 |
| - { |
43 |
| - tag: [t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace], |
44 |
| - color: '#d33682', |
45 |
| - }, |
46 |
| - { |
47 |
| - tag: [t.typeName, t.className], |
48 |
| - color: '#cb4b16', |
49 |
| - }, |
50 |
| - { |
51 |
| - tag: [t.operator, t.operatorKeyword], |
52 |
| - color: '#6c71c4', |
53 |
| - }, |
54 |
| - { |
55 |
| - tag: [t.tagName], |
56 |
| - color: '#268bd2', |
57 |
| - }, |
58 |
| - { |
59 |
| - tag: [t.squareBracket], |
60 |
| - color: '#dc322f', |
61 |
| - }, |
62 |
| - { |
63 |
| - tag: [t.angleBracket], |
64 |
| - color: '#073642', |
65 |
| - }, |
66 |
| - { |
67 |
| - tag: [t.attributeName], |
68 |
| - color: '#93a1a1', |
69 |
| - }, |
70 |
| - { |
71 |
| - tag: [t.regexp], |
72 |
| - color: '#d30102', |
73 |
| - }, |
74 |
| - { |
75 |
| - tag: [t.quote], |
76 |
| - color: '#859900', |
77 |
| - }, |
78 |
| - { tag: [t.string], color: '#b58900' }, |
79 |
| - { |
80 |
| - tag: t.link, |
81 |
| - color: '#2aa198', |
82 |
| - textDecoration: 'underline', |
83 |
| - textUnderlinePosition: 'under', |
84 |
| - }, |
85 |
| - { |
86 |
| - tag: [t.url, t.escape, t.special(t.string)], |
87 |
| - color: '#b58900', |
88 |
| - }, |
89 |
| - { tag: [t.meta], color: '#dc322f' }, |
90 |
| - { tag: [t.comment], color: '#586e75', fontStyle: 'italic' }, |
91 |
| - { tag: t.strong, fontWeight: 'bold', color: '#586e75' }, |
92 |
| - { tag: t.emphasis, fontStyle: 'italic', color: '#859900' }, |
93 |
| - { tag: t.strikethrough, textDecoration: 'line-through' }, |
94 |
| - { tag: t.heading, fontWeight: 'bold', color: '#b58900' }, |
95 |
| - { tag: t.heading1, fontWeight: 'bold', color: '#002b36' }, |
96 |
| - { |
97 |
| - tag: [t.heading2, t.heading3, t.heading4], |
98 |
| - fontWeight: 'bold', |
99 |
| - color: '#002b36', |
100 |
| - }, |
101 |
| - { |
102 |
| - tag: [t.heading5, t.heading6], |
103 |
| - color: '#002b36', |
104 |
| - }, |
105 |
| - { tag: [t.atom, t.bool, t.special(t.variableName)], color: '#d33682' }, |
106 |
| - { |
107 |
| - tag: [t.processingInstruction, t.inserted, t.contentSeparator], |
108 |
| - color: '#dc322f', |
109 |
| - }, |
110 |
| - { |
111 |
| - tag: [t.contentSeparator], |
112 |
| - color: '#b58900', |
113 |
| - }, |
114 |
| - { tag: t.invalid, color: '#073642', borderBottom: `1px dotted #dc322f` }, |
115 |
| - ...styles, |
116 |
| - ], |
117 |
| - }); |
118 |
| -}; |
119 |
| - |
120 |
| -export const solarizedLight = solarizedLightInit(); |
121 |
| - |
122 |
| -export const defaultSettingsSolarizedDark: CreateThemeOptions['settings'] = { |
123 |
| - background: '#002b36', |
124 |
| - foreground: '#93a1a1', |
125 |
| - caret: '#839496', |
126 |
| - selection: '#173541', |
127 |
| - selectionMatch: '#aafe661a', |
128 |
| - gutterBackground: '#00252f', |
129 |
| - gutterForeground: '#839496', |
130 |
| - lineHighlight: '#173541', |
131 |
| -}; |
132 |
| - |
133 |
| -export const solarizedDarkInit = (options?: Partial<CreateThemeOptions>) => { |
134 |
| - const { theme = 'dark', settings = {}, styles = [] } = options || {}; |
135 |
| - return createTheme({ |
136 |
| - theme: theme, |
137 |
| - settings: { |
138 |
| - ...defaultSettingsSolarizedDark, |
139 |
| - ...settings, |
140 |
| - }, |
141 |
| - styles: [ |
142 |
| - { tag: t.keyword, color: '#859900' }, |
143 |
| - { |
144 |
| - tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName], |
145 |
| - color: '#2aa198', |
146 |
| - }, |
147 |
| - { tag: [t.variableName], color: '#93a1a1' }, |
148 |
| - { tag: [t.function(t.variableName)], color: '#268bd2' }, |
149 |
| - { tag: [t.labelName], color: '#d33682' }, |
150 |
| - { |
151 |
| - tag: [t.color, t.constant(t.name), t.standard(t.name)], |
152 |
| - color: '#b58900', |
153 |
| - }, |
154 |
| - { tag: [t.definition(t.name), t.separator], color: '#2aa198' }, |
155 |
| - { tag: [t.brace], color: '#d33682' }, |
156 |
| - { |
157 |
| - tag: [t.annotation], |
158 |
| - color: '#d30102', |
159 |
| - }, |
160 |
| - { |
161 |
| - tag: [t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace], |
162 |
| - color: '#d33682', |
163 |
| - }, |
164 |
| - { |
165 |
| - tag: [t.typeName, t.className], |
166 |
| - color: '#cb4b16', |
167 |
| - }, |
168 |
| - { |
169 |
| - tag: [t.operator, t.operatorKeyword], |
170 |
| - color: '#6c71c4', |
171 |
| - }, |
172 |
| - { |
173 |
| - tag: [t.tagName], |
174 |
| - color: '#268bd2', |
175 |
| - }, |
176 |
| - { |
177 |
| - tag: [t.squareBracket], |
178 |
| - color: '#dc322f', |
179 |
| - }, |
180 |
| - { |
181 |
| - tag: [t.angleBracket], |
182 |
| - color: '#586e75', |
183 |
| - }, |
184 |
| - { |
185 |
| - tag: [t.attributeName], |
186 |
| - color: '#93a1a1', |
187 |
| - }, |
188 |
| - { |
189 |
| - tag: [t.regexp], |
190 |
| - color: '#d30102', |
191 |
| - }, |
192 |
| - { |
193 |
| - tag: [t.quote], |
194 |
| - color: '#859900', |
195 |
| - }, |
196 |
| - { tag: [t.string], color: '#b58900' }, |
197 |
| - { |
198 |
| - tag: t.link, |
199 |
| - color: '#2aa198', |
200 |
| - textDecoration: 'underline', |
201 |
| - textUnderlinePosition: 'under', |
202 |
| - }, |
203 |
| - { |
204 |
| - tag: [t.url, t.escape, t.special(t.string)], |
205 |
| - color: '#b58900', |
206 |
| - }, |
207 |
| - { tag: [t.meta], color: '#dc322f' }, |
208 |
| - { tag: [t.comment], color: '#586e75', fontStyle: 'italic' }, |
209 |
| - { tag: t.strong, fontWeight: 'bold', color: '#eee8d5' }, |
210 |
| - { tag: t.emphasis, fontStyle: 'italic', color: '#859900' }, |
211 |
| - { tag: t.strikethrough, textDecoration: 'line-through' }, |
212 |
| - { tag: t.heading, fontWeight: 'bold', color: '#b58900' }, |
213 |
| - { tag: t.heading1, fontWeight: 'bold', color: '#fdf6e3' }, |
214 |
| - { |
215 |
| - tag: [t.heading2, t.heading3, t.heading4], |
216 |
| - fontWeight: 'bold', |
217 |
| - color: '#eee8d5', |
218 |
| - }, |
219 |
| - { |
220 |
| - tag: [t.heading5, t.heading6], |
221 |
| - color: '#eee8d5', |
222 |
| - }, |
223 |
| - { tag: [t.atom, t.bool, t.special(t.variableName)], color: '#d33682' }, |
224 |
| - { |
225 |
| - tag: [t.processingInstruction, t.inserted, t.contentSeparator], |
226 |
| - color: '#dc322f', |
227 |
| - }, |
228 |
| - { |
229 |
| - tag: [t.contentSeparator], |
230 |
| - color: '#b58900', |
231 |
| - }, |
232 |
| - { tag: t.invalid, color: '#586e75', borderBottom: `1px dotted #dc322f` }, |
233 |
| - ...styles, |
234 |
| - ], |
235 |
| - }); |
236 |
| -}; |
237 |
| - |
238 |
| -export const solarizedDark = solarizedDarkInit(); |
| 1 | +export * from './dark'; |
| 2 | +export * from './light'; |
0 commit comments