@fsegurai/codemirror-theme-basic-light 6.0.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,28 @@
1
+ <!-- NOTE: README.md is generated from src/README.md -->
2
+
3
+ # @fsegurai/codemirror-theme-basic-light [![NPM version](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-basic-light.svg)](https://www.npmjs.org/package/@fsegurai/codemirror-theme-basic-light)
4
+
5
+ [ [**WEBSITE**](https://codemirror.net/6/) | [**ISSUES**](https://github.com/codemirror/codemirror.next/issues) | [**FORUM**](https://discuss.codemirror.net/c/next/) | [**CHANGELOG**](https://github.com/codemirror/theme-one-dark/blob/main/CHANGELOG.md) ]
6
+
7
+ This package implements the Basic Light theme for the
8
+ [CodeMirror](https://codemirror.net/6/) code editor.
9
+
10
+ The [project page](https://codemirror.net/6/) has more information, a
11
+ number of [examples](https://codemirror.net/6/examples/) and the
12
+ [documentation](https://codemirror.net/6/docs/).
13
+
14
+ This code is released under an
15
+ [MIT license](https://github.com/fsegurai/cm6-themes/tree/main/LICENSE).
16
+
17
+ We aim to be an inclusive, welcoming community. To make that explicit,
18
+ we have a [code of
19
+ conduct](http://contributor-covenant.org/version/1/1/0/) that applies
20
+ to communication around the project.
21
+
22
+ ## API Reference
23
+
24
+ @basicLight
25
+
26
+ @basicLightTheme
27
+
28
+ @basicLightHighlightStyle
package/dist/index.cjs ADDED
@@ -0,0 +1,192 @@
1
+ 'use strict';
2
+
3
+ var view = require('@codemirror/view');
4
+ var language = require('@codemirror/language');
5
+ var highlight = require('@lezer/highlight');
6
+
7
+ // Colors from https://www.nordtheme.com/docs/colors-and-palettes
8
+ // Polar Night
9
+ const base00 = '#2e3440', // black
10
+ base01 = '#3b4252', // dark grey
11
+ base02 = '#434c5e', base03 = '#4c566a'; // grey
12
+ // Snow Storm
13
+ const base05 = '#e5e9f0', // off white
14
+ base06 = '#eceff4'; // white
15
+ // Frost
16
+ const base07 = '#8fbcbb', // moss green
17
+ base08 = '#88c0d0', // ice blue
18
+ base09 = '#81a1c1', // water blue
19
+ base0A = '#5e81ac'; // deep blue
20
+ // Aurora
21
+ const base0b = '#bf616a', // red
22
+ base0C = '#d08770', // orange
23
+ base0D = '#ebcb8b', // yellow
24
+ base0E = '#a3be8c', // green
25
+ base0F = '#b48ead'; // purple
26
+ const invalid = '#d30102', darkBackground = base06, highlightBackground = darkBackground, background = '#ffffff', tooltipBackground = base05, selection = darkBackground, cursor = base01;
27
+ /// The editor theme styles for Basic Light.
28
+ const basicLightTheme = view.EditorView.theme({
29
+ '&': {
30
+ color: base00,
31
+ backgroundColor: background
32
+ },
33
+ '.cm-content': {
34
+ caretColor: cursor
35
+ },
36
+ '.cm-cursor, .cm-dropCursor': { borderLeftColor: cursor },
37
+ '&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': { backgroundColor: selection },
38
+ '.cm-panels': { backgroundColor: darkBackground, color: base03 },
39
+ '.cm-panels.cm-panels-top': { borderBottom: '2px solid black' },
40
+ '.cm-panels.cm-panels-bottom': { borderTop: '2px solid black' },
41
+ '.cm-searchMatch': {
42
+ backgroundColor: '#72a1ff59',
43
+ outline: `1px solid ${base03}`
44
+ },
45
+ '.cm-searchMatch.cm-searchMatch-selected': {
46
+ backgroundColor: base05
47
+ },
48
+ '.cm-activeLine': { backgroundColor: highlightBackground },
49
+ '.cm-selectionMatch': { backgroundColor: base05 },
50
+ '&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket': {
51
+ outline: `1px solid ${base03}`
52
+ },
53
+ '&.cm-focused .cm-matchingBracket': {
54
+ backgroundColor: base06
55
+ },
56
+ '.cm-gutters': {
57
+ backgroundColor: base06,
58
+ color: base00,
59
+ border: 'none'
60
+ },
61
+ '.cm-activeLineGutter': {
62
+ backgroundColor: highlightBackground
63
+ },
64
+ '.cm-foldPlaceholder': {
65
+ backgroundColor: 'transparent',
66
+ border: 'none',
67
+ color: '#ddd'
68
+ },
69
+ '.cm-tooltip': {
70
+ border: 'none',
71
+ backgroundColor: tooltipBackground
72
+ },
73
+ '.cm-tooltip .cm-tooltip-arrow:before': {
74
+ borderTopColor: 'transparent',
75
+ borderBottomColor: 'transparent'
76
+ },
77
+ '.cm-tooltip .cm-tooltip-arrow:after': {
78
+ borderTopColor: tooltipBackground,
79
+ borderBottomColor: tooltipBackground
80
+ },
81
+ '.cm-tooltip-autocomplete': {
82
+ '& > ul > li[aria-selected]': {
83
+ backgroundColor: highlightBackground,
84
+ color: base03
85
+ }
86
+ }
87
+ }, { dark: false });
88
+ /// The highlighting style for code in the Basic Light theme.
89
+ const basicLightHighlightStyle = language.HighlightStyle.define([
90
+ { tag: highlight.tags.keyword, color: base0A },
91
+ {
92
+ tag: [highlight.tags.name, highlight.tags.deleted, highlight.tags.character, highlight.tags.propertyName, highlight.tags.macroName],
93
+ color: base0C
94
+ },
95
+ { tag: [highlight.tags.variableName], color: base0C },
96
+ { tag: [highlight.tags.function(highlight.tags.variableName)], color: base0A },
97
+ { tag: [highlight.tags.labelName], color: base09 },
98
+ {
99
+ tag: [highlight.tags.color, highlight.tags.constant(highlight.tags.name), highlight.tags.standard(highlight.tags.name)],
100
+ color: base0A
101
+ },
102
+ { tag: [highlight.tags.definition(highlight.tags.name), highlight.tags.separator], color: base0E },
103
+ { tag: [highlight.tags.brace], color: base07 },
104
+ {
105
+ tag: [highlight.tags.annotation],
106
+ color: invalid
107
+ },
108
+ {
109
+ tag: [highlight.tags.number, highlight.tags.changed, highlight.tags.annotation, highlight.tags.modifier, highlight.tags.self, highlight.tags.namespace],
110
+ color: base08
111
+ },
112
+ {
113
+ tag: [highlight.tags.typeName, highlight.tags.className],
114
+ color: base0D
115
+ },
116
+ {
117
+ tag: [highlight.tags.operator, highlight.tags.operatorKeyword],
118
+ color: base0E
119
+ },
120
+ {
121
+ tag: [highlight.tags.tagName],
122
+ color: base0F
123
+ },
124
+ {
125
+ tag: [highlight.tags.squareBracket],
126
+ color: base0b
127
+ },
128
+ {
129
+ tag: [highlight.tags.angleBracket],
130
+ color: base0C
131
+ },
132
+ {
133
+ tag: [highlight.tags.attributeName],
134
+ color: base0D
135
+ },
136
+ {
137
+ tag: [highlight.tags.regexp],
138
+ color: base0A
139
+ },
140
+ {
141
+ tag: [highlight.tags.quote],
142
+ color: base01
143
+ },
144
+ { tag: [highlight.tags.string], color: base0C },
145
+ {
146
+ tag: highlight.tags.link,
147
+ color: base07,
148
+ textDecoration: 'underline',
149
+ textUnderlinePosition: 'under'
150
+ },
151
+ {
152
+ tag: [highlight.tags.url, highlight.tags.escape, highlight.tags.special(highlight.tags.string)],
153
+ color: base0C
154
+ },
155
+ { tag: [highlight.tags.meta], color: base08 },
156
+ { tag: [highlight.tags.comment], color: base02, fontStyle: 'italic' },
157
+ { tag: highlight.tags.strong, fontWeight: 'bold', color: base0A },
158
+ { tag: highlight.tags.emphasis, fontStyle: 'italic', color: base0A },
159
+ { tag: highlight.tags.strikethrough, textDecoration: 'line-through' },
160
+ { tag: highlight.tags.heading, fontWeight: 'bold', color: base0A },
161
+ { tag: highlight.tags.special(highlight.tags.heading1), fontWeight: 'bold', color: base0A },
162
+ { tag: highlight.tags.heading1, fontWeight: 'bold', color: base0A },
163
+ {
164
+ tag: [highlight.tags.heading2, highlight.tags.heading3, highlight.tags.heading4],
165
+ fontWeight: 'bold',
166
+ color: base0A
167
+ },
168
+ {
169
+ tag: [highlight.tags.heading5, highlight.tags.heading6],
170
+ color: base0A
171
+ },
172
+ { tag: [highlight.tags.atom, highlight.tags.bool, highlight.tags.special(highlight.tags.variableName)], color: base0C },
173
+ {
174
+ tag: [highlight.tags.processingInstruction, highlight.tags.inserted],
175
+ color: base07
176
+ },
177
+ {
178
+ tag: [highlight.tags.contentSeparator],
179
+ color: base0D
180
+ },
181
+ { tag: highlight.tags.invalid, color: base02, borderBottom: `1px dotted ${invalid}` }
182
+ ]);
183
+ /// Extension to enable the Basic Light theme (both the editor theme and
184
+ /// the highlight style).
185
+ const basicLight = [
186
+ basicLightTheme,
187
+ language.syntaxHighlighting(basicLightHighlightStyle)
188
+ ];
189
+
190
+ exports.basicLight = basicLight;
191
+ exports.basicLightHighlightStyle = basicLightHighlightStyle;
192
+ exports.basicLightTheme = basicLightTheme;
@@ -0,0 +1,8 @@
1
+ import { Extension } from '@codemirror/state';
2
+ import { HighlightStyle } from '@codemirror/language';
3
+
4
+ declare const basicLightTheme: Extension;
5
+ declare const basicLightHighlightStyle: HighlightStyle;
6
+ declare const basicLight: Extension;
7
+
8
+ export { basicLight, basicLightHighlightStyle, basicLightTheme };
@@ -0,0 +1,8 @@
1
+ import { Extension } from '@codemirror/state';
2
+ import { HighlightStyle } from '@codemirror/language';
3
+
4
+ declare const basicLightTheme: Extension;
5
+ declare const basicLightHighlightStyle: HighlightStyle;
6
+ declare const basicLight: Extension;
7
+
8
+ export { basicLight, basicLightHighlightStyle, basicLightTheme };
package/dist/index.js ADDED
@@ -0,0 +1,188 @@
1
+ import { EditorView } from '@codemirror/view';
2
+ import { HighlightStyle, syntaxHighlighting } from '@codemirror/language';
3
+ import { tags } from '@lezer/highlight';
4
+
5
+ // Colors from https://www.nordtheme.com/docs/colors-and-palettes
6
+ // Polar Night
7
+ const base00 = '#2e3440', // black
8
+ base01 = '#3b4252', // dark grey
9
+ base02 = '#434c5e', base03 = '#4c566a'; // grey
10
+ // Snow Storm
11
+ const base05 = '#e5e9f0', // off white
12
+ base06 = '#eceff4'; // white
13
+ // Frost
14
+ const base07 = '#8fbcbb', // moss green
15
+ base08 = '#88c0d0', // ice blue
16
+ base09 = '#81a1c1', // water blue
17
+ base0A = '#5e81ac'; // deep blue
18
+ // Aurora
19
+ const base0b = '#bf616a', // red
20
+ base0C = '#d08770', // orange
21
+ base0D = '#ebcb8b', // yellow
22
+ base0E = '#a3be8c', // green
23
+ base0F = '#b48ead'; // purple
24
+ const invalid = '#d30102', darkBackground = base06, highlightBackground = darkBackground, background = '#ffffff', tooltipBackground = base05, selection = darkBackground, cursor = base01;
25
+ /// The editor theme styles for Basic Light.
26
+ const basicLightTheme = /*@__PURE__*/EditorView.theme({
27
+ '&': {
28
+ color: base00,
29
+ backgroundColor: background
30
+ },
31
+ '.cm-content': {
32
+ caretColor: cursor
33
+ },
34
+ '.cm-cursor, .cm-dropCursor': { borderLeftColor: cursor },
35
+ '&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': { backgroundColor: selection },
36
+ '.cm-panels': { backgroundColor: darkBackground, color: base03 },
37
+ '.cm-panels.cm-panels-top': { borderBottom: '2px solid black' },
38
+ '.cm-panels.cm-panels-bottom': { borderTop: '2px solid black' },
39
+ '.cm-searchMatch': {
40
+ backgroundColor: '#72a1ff59',
41
+ outline: `1px solid ${base03}`
42
+ },
43
+ '.cm-searchMatch.cm-searchMatch-selected': {
44
+ backgroundColor: base05
45
+ },
46
+ '.cm-activeLine': { backgroundColor: highlightBackground },
47
+ '.cm-selectionMatch': { backgroundColor: base05 },
48
+ '&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket': {
49
+ outline: `1px solid ${base03}`
50
+ },
51
+ '&.cm-focused .cm-matchingBracket': {
52
+ backgroundColor: base06
53
+ },
54
+ '.cm-gutters': {
55
+ backgroundColor: base06,
56
+ color: base00,
57
+ border: 'none'
58
+ },
59
+ '.cm-activeLineGutter': {
60
+ backgroundColor: highlightBackground
61
+ },
62
+ '.cm-foldPlaceholder': {
63
+ backgroundColor: 'transparent',
64
+ border: 'none',
65
+ color: '#ddd'
66
+ },
67
+ '.cm-tooltip': {
68
+ border: 'none',
69
+ backgroundColor: tooltipBackground
70
+ },
71
+ '.cm-tooltip .cm-tooltip-arrow:before': {
72
+ borderTopColor: 'transparent',
73
+ borderBottomColor: 'transparent'
74
+ },
75
+ '.cm-tooltip .cm-tooltip-arrow:after': {
76
+ borderTopColor: tooltipBackground,
77
+ borderBottomColor: tooltipBackground
78
+ },
79
+ '.cm-tooltip-autocomplete': {
80
+ '& > ul > li[aria-selected]': {
81
+ backgroundColor: highlightBackground,
82
+ color: base03
83
+ }
84
+ }
85
+ }, { dark: false });
86
+ /// The highlighting style for code in the Basic Light theme.
87
+ const basicLightHighlightStyle = /*@__PURE__*/HighlightStyle.define([
88
+ { tag: tags.keyword, color: base0A },
89
+ {
90
+ tag: [tags.name, tags.deleted, tags.character, tags.propertyName, tags.macroName],
91
+ color: base0C
92
+ },
93
+ { tag: [tags.variableName], color: base0C },
94
+ { tag: [/*@__PURE__*/tags.function(tags.variableName)], color: base0A },
95
+ { tag: [tags.labelName], color: base09 },
96
+ {
97
+ tag: [tags.color, /*@__PURE__*/tags.constant(tags.name), /*@__PURE__*/tags.standard(tags.name)],
98
+ color: base0A
99
+ },
100
+ { tag: [/*@__PURE__*/tags.definition(tags.name), tags.separator], color: base0E },
101
+ { tag: [tags.brace], color: base07 },
102
+ {
103
+ tag: [tags.annotation],
104
+ color: invalid
105
+ },
106
+ {
107
+ tag: [tags.number, tags.changed, tags.annotation, tags.modifier, tags.self, tags.namespace],
108
+ color: base08
109
+ },
110
+ {
111
+ tag: [tags.typeName, tags.className],
112
+ color: base0D
113
+ },
114
+ {
115
+ tag: [tags.operator, tags.operatorKeyword],
116
+ color: base0E
117
+ },
118
+ {
119
+ tag: [tags.tagName],
120
+ color: base0F
121
+ },
122
+ {
123
+ tag: [tags.squareBracket],
124
+ color: base0b
125
+ },
126
+ {
127
+ tag: [tags.angleBracket],
128
+ color: base0C
129
+ },
130
+ {
131
+ tag: [tags.attributeName],
132
+ color: base0D
133
+ },
134
+ {
135
+ tag: [tags.regexp],
136
+ color: base0A
137
+ },
138
+ {
139
+ tag: [tags.quote],
140
+ color: base01
141
+ },
142
+ { tag: [tags.string], color: base0C },
143
+ {
144
+ tag: tags.link,
145
+ color: base07,
146
+ textDecoration: 'underline',
147
+ textUnderlinePosition: 'under'
148
+ },
149
+ {
150
+ tag: [tags.url, tags.escape, /*@__PURE__*/tags.special(tags.string)],
151
+ color: base0C
152
+ },
153
+ { tag: [tags.meta], color: base08 },
154
+ { tag: [tags.comment], color: base02, fontStyle: 'italic' },
155
+ { tag: tags.strong, fontWeight: 'bold', color: base0A },
156
+ { tag: tags.emphasis, fontStyle: 'italic', color: base0A },
157
+ { tag: tags.strikethrough, textDecoration: 'line-through' },
158
+ { tag: tags.heading, fontWeight: 'bold', color: base0A },
159
+ { tag: /*@__PURE__*/tags.special(tags.heading1), fontWeight: 'bold', color: base0A },
160
+ { tag: tags.heading1, fontWeight: 'bold', color: base0A },
161
+ {
162
+ tag: [tags.heading2, tags.heading3, tags.heading4],
163
+ fontWeight: 'bold',
164
+ color: base0A
165
+ },
166
+ {
167
+ tag: [tags.heading5, tags.heading6],
168
+ color: base0A
169
+ },
170
+ { tag: [tags.atom, tags.bool, /*@__PURE__*/tags.special(tags.variableName)], color: base0C },
171
+ {
172
+ tag: [tags.processingInstruction, tags.inserted],
173
+ color: base07
174
+ },
175
+ {
176
+ tag: [tags.contentSeparator],
177
+ color: base0D
178
+ },
179
+ { tag: tags.invalid, color: base02, borderBottom: `1px dotted ${invalid}` }
180
+ ]);
181
+ /// Extension to enable the Basic Light theme (both the editor theme and
182
+ /// the highlight style).
183
+ const basicLight = [
184
+ basicLightTheme,
185
+ /*@__PURE__*/syntaxHighlighting(basicLightHighlightStyle)
186
+ ];
187
+
188
+ export { basicLight, basicLightHighlightStyle, basicLightTheme };
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@fsegurai/codemirror-theme-basic-light",
3
+ "description": "Basic Light theme for the CodeMirror code editor",
4
+ "version": "6.0.1-alpha.0",
5
+ "type": "module",
6
+ "main": "dist/index.cjs",
7
+ "exports": {
8
+ "import": "./dist/index.js",
9
+ "require": "./dist/index.cjs"
10
+ },
11
+ "types": "dist/index.d.ts",
12
+ "module": "dist/index.js",
13
+ "sideEffects": false,
14
+ "scripts": {
15
+ "test": "cm-runtests",
16
+ "prepare": "cm-buildhelper src/index.ts"
17
+ },
18
+ "keywords": [
19
+ "editor",
20
+ "code",
21
+ "codemirror"
22
+ ],
23
+ "author": {
24
+ "name": "Fabián Segura",
25
+ "url": "https://www.fsegurai.com/"
26
+ },
27
+ "license": "MIT",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/fsegurai/codemirror-themes.git"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/fsegurai/codemirror-themes/issues"
34
+ },
35
+ "homepage": "https://github.com/fsegurai/codemirror-themes#readme",
36
+ "peerDependencies": {
37
+ "@lezer/highlight": "^1.0.0",
38
+ "@codemirror/language": "^6.0.0",
39
+ "@codemirror/state": "^6.0.0",
40
+ "@codemirror/view": "^6.0.0"
41
+ },
42
+ "devDependencies": {
43
+ "@codemirror/buildhelper": "^1.0.1"
44
+ }
45
+ }