-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlightTheme.js
More file actions
217 lines (198 loc) · 5.45 KB
/
lightTheme.js
File metadata and controls
217 lines (198 loc) · 5.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
// see :https://github.com/craftzdog/cm6-themes
import { EditorView } from '@codemirror/view'
import { HighlightStyle, syntaxHighlighting } from '@codemirror/language'
import { tags as t } from '@lezer/highlight'
// Colors from https://www.nordtheme.com/docs/colors-and-palettes
// Polar Night
const base00 = '#2e3440', // black
base01 = '#3b4252', // dark grey
base02 = '#434c5e',
base03 = '#4c566a' // grey
// Snow Storm
const base04 = '#d8dee9', // grey
base05 = '#e5e9f0', // off white
base06 = '#eceff4' // white
// Frost
const base07 = '#8fbcbb', // moss green
base08 = '#88c0d0', // ice blue
base09 = '#81a1c1', // water blue
base0A = '#5e81ac' // deep blue
// Aurora
const base0b = '#bf616a', // red
base0C = '#d08770', // orange
base0D = '#ebcb8b', // yellow
base0E = '#a3be8c', // green
base0F = '#b48ead' // purple
const invalid = '#d30102',
darkBackground = base06,
highlightBackground = darkBackground,
background = '#ffffff',
tooltipBackground = base05,
selection = darkBackground,
cursor = base01
/// The editor theme styles for Basic Light.
export const basicLightTheme = EditorView.theme(
{
'&': {
color: base00,
backgroundColor: background
},
'.cm-content': {
caretColor: cursor
},
'.cm-cursor, .cm-dropCursor': { borderLeftColor: cursor },
'&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection':
{ backgroundColor: selection },
'.cm-panels': { backgroundColor: darkBackground, color: base03 },
'.cm-panels.cm-panels-top': { borderBottom: '2px solid black' },
'.cm-panels.cm-panels-bottom': { borderTop: '2px solid black' },
'.cm-searchMatch': {
backgroundColor: '#72a1ff59',
outline: `1px solid ${base03}`
},
'.cm-searchMatch.cm-searchMatch-selected': {
backgroundColor: base05
},
'.cm-activeLine': { backgroundColor: highlightBackground },
'.cm-selectionMatch': { backgroundColor: base05 },
'&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket': {
outline: `1px solid ${base03}`
},
'&.cm-focused .cm-matchingBracket': {
backgroundColor: base06
},
'.cm-gutters': {
backgroundColor: base06,
color: base00,
border: 'none'
},
'.cm-activeLineGutter': {
backgroundColor: highlightBackground
},
'.cm-foldPlaceholder': {
backgroundColor: 'transparent',
border: 'none',
color: '#ddd'
},
'.cm-tooltip': {
border: 'none',
backgroundColor: tooltipBackground
},
'.cm-tooltip .cm-tooltip-arrow:before': {
borderTopColor: 'transparent',
borderBottomColor: 'transparent'
},
'.cm-tooltip .cm-tooltip-arrow:after': {
borderTopColor: tooltipBackground,
borderBottomColor: tooltipBackground
},
'.cm-tooltip-autocomplete': {
'& > ul > li[aria-selected]': {
backgroundColor: highlightBackground,
color: base03
}
}
},
{ dark: false }
)
/// The highlighting style for code in the Basic Light theme.
export const basicLightHighlightStyle = HighlightStyle.define([
{ tag: t.keyword, color: base0A },
{
tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName],
color: base0C
},
{ tag: [t.variableName], color: base0C },
{ tag: [t.function(t.variableName)], color: base0A },
{ tag: [t.labelName], color: base09 },
{
tag: [t.color, t.constant(t.name), t.standard(t.name)],
color: base0A
},
{ tag: [t.definition(t.name), t.separator], color: base0E },
{ tag: [t.brace], color: base07 },
{
tag: [t.annotation],
color: invalid
},
{
tag: [t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace],
color: base08
},
{
tag: [t.typeName, t.className],
color: base0D
},
{
tag: [t.operator, t.operatorKeyword],
color: base0E
},
{
tag: [t.tagName],
color: base0F
},
{
tag: [t.squareBracket],
color: base0b
},
{
tag: [t.angleBracket],
color: base0C
},
{
tag: [t.attributeName],
color: base0D
},
{
tag: [t.regexp],
color: base0A
},
{
tag: [t.quote],
color: base01
},
{ tag: [t.string], color: base0C },
{
tag: t.link,
color: base07,
textDecoration: 'underline',
textUnderlinePosition: 'under'
},
{
tag: [t.url, t.escape, t.special(t.string)],
color: base0C
},
{ tag: [t.meta], color: base08 },
{ tag: [t.comment], color: base02, fontStyle: 'italic' },
{ tag: t.strong, fontWeight: 'bold', color: base0A },
{ tag: t.emphasis, fontStyle: 'italic', color: base0A },
{ tag: t.strikethrough, textDecoration: 'line-through' },
{ tag: t.heading, fontWeight: 'bold', color: base0A },
{ tag: t.special(t.heading1), fontWeight: 'bold', color: base0A },
{ tag: t.heading1, fontWeight: 'bold', color: base0A },
{
tag: [t.heading2, t.heading3, t.heading4],
fontWeight: 'bold',
color: base0A
},
{
tag: [t.heading5, t.heading6],
color: base0A
},
{ tag: [t.atom, t.bool, t.special(t.variableName)], color: base0C },
{
tag: [t.processingInstruction, t.inserted],
color: base07
},
{
tag: [t.contentSeparator],
color: base0D
},
{ tag: t.invalid, color: base02, borderBottom: `1px dotted ${invalid}` }
])
/// Extension to enable the Basic Light theme (both the editor theme and
/// the highlight style).
export const basicLight = [
basicLightTheme,
syntaxHighlighting(basicLightHighlightStyle)
]