@fsegurai/codemirror-theme-palenight 6.1.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,115 @@
1
+ <p align="center">
2
+ <img alt="CodeMirror 6 Themes Logo" src="https://raw.githubusercontent.com/fsegurai/codemirror-themes/main/demo/public/codemirror-themes.png">
3
+ </p>
4
+
5
+ <p align="center">
6
+ <a href="https://github.com/fsegurai/codemirror-themes/actions/workflows/release-library.yml">
7
+ <img src="https://github.com/fsegurai/codemirror-themes/actions/workflows/release-library.yml/badge.svg"
8
+ alt="Build Status">
9
+ </a>
10
+ <a href="https://www.npmjs.org/package/@fsegurai/codemirror-theme-palenight">
11
+ <img src="https://img.shields.io/npm/v/@fsegurai/codemirror-theme-palenight.svg"
12
+ alt="Latest Release">
13
+ </a>
14
+ <br>
15
+ <img alt="GitHub contributors" src="https://img.shields.io/github/contributors/fsegurai/codemirror-themes">
16
+ <img alt="Dependency status for repo" src="https://img.shields.io/librariesio/github/fsegurai/codemirror-themes">
17
+ <a href="https://opensource.org/licenses/MIT">
18
+ <img alt="GitHub License" src="https://img.shields.io/github/license/fsegurai/codemirror-themes">
19
+ </a>
20
+ <br>
21
+ <img alt="Stars" src="https://img.shields.io/github/stars/fsegurai/codemirror-themes?style=square&labelColor=343b41"/>
22
+ <img alt="Forks" src="https://img.shields.io/github/forks/fsegurai/codemirror-themes?style=square&labelColor=343b41"/>
23
+ </p>
24
+
25
+ **A library of custom themes for CodeMirror 6.**
26
+
27
+ `@fsegurai/codemirror-theme-palenight` is a theme for CodeMirror 6 editor, making it visually engaging and adaptable to different coding styles and user preferences.
28
+
29
+ ### Table of contents
30
+
31
+ - [Installation](#installation)
32
+ - [@fsegurai/codemirror-theme-palenight](#fseguraicodemirror-theme-palenight)
33
+ - [Using Theme](#using-theme)
34
+ - [Available Themes](#available-themes)
35
+ - [Demo Application](#demo-application)
36
+ - [License](#license)
37
+
38
+ ## Installation
39
+
40
+ ### @fsegurai/codemirror-theme-palenight
41
+
42
+ To add `@fsegurai/codemirror-theme-palenight` along with CodeMirror 6 to your `package.json` use the following commands.
43
+
44
+ ```bash
45
+ npm install @fsegurai/codemirror-theme-palenight codemirror@^6.0.0 --save
46
+ ```
47
+
48
+ ### Using Theme
49
+
50
+ Import the respective theme from the package and apply it to your CodeMirror instance as shown below.
51
+
52
+ ```javascript
53
+ import { EditorView, basicSetup } from 'codemirror'
54
+ import { markdown } from '@codemirror/lang-markdown'
55
+ import { palenight } from '@fsegurai/codemirror-theme-basic-palenight'
56
+
57
+ let editor = new EditorView({
58
+ doc: '# Hello World',
59
+ extensions: [
60
+ basicSetup,
61
+ markdown(),
62
+ palenight
63
+ ],
64
+ parent: document.body
65
+ })
66
+ ```
67
+
68
+ Read the [CodeMirror documentation](https://codemirror.net/6/examples/styling/) for more details about themes.
69
+
70
+ ### Available Themes
71
+
72
+ - [All - Bundle](./packages/bundle)
73
+ - [Abcdef](./packages/abcdef)
74
+ - [Abyss](./packages/abyss)
75
+ - [Android Studio](./packages/android-studio)
76
+ - [Andromeda](./packages/andromeda)
77
+ - [Basic Dark](./packages/basic-dark)
78
+ - [Basic Light](./packages/basic-light)
79
+ - [Forest](./packages/forest)
80
+ - [GitHub Dark](./packages/github-dark)
81
+ - [GitHub Light](./packages/github-light)
82
+ - [Gruvbox Dark](./packages/gruvbox-dark)
83
+ - [Gruvbox Light](./packages/gruvbox-light)
84
+ - [Material Dark](./packages/material-dark)
85
+ - [Material Light](./packages/material-light)
86
+ - [Monokai](./packages/monokai)
87
+ - [Nord](./packages/nord)
88
+ - [Palenight](./packages/palenight)
89
+ - [Solarized Dark](./packages/solarized-dark)
90
+ - [Solarized Light](./packages/solarized-light)
91
+ - [Tokyo Night Day](./packages/tokyo-night-day)
92
+ - [Tokyo Night Storm](./packages/tokyo-night-storm)
93
+ - [Volcano](./packages/volcano)
94
+ - [VS Code Dark](./packages/vscode-dark)
95
+ - [VS Code Light](./packages/vscode-light)
96
+
97
+ For a full list, see the [`@fsegurai/codemirror-theme-bundle`](./packages/bundle) directory or the online [DEMO](https://fsegurai.github.io/codemirror-themes/).
98
+
99
+ ### Demo Application
100
+
101
+ To see all themes in action, check out the demo: [https://fsegurai.github.io/codemirror-themes](https://fsegurai.github.io/codemirror-themes).
102
+
103
+ To set up the demo locally:
104
+
105
+ ```bash
106
+ git clone https://github.com/fsegurai/codemirror-themes.git
107
+ npm install
108
+ npm start
109
+ ```
110
+
111
+ This will serve the application locally at [http://[::1]:8000](http://[::1]:8000).
112
+
113
+ ## License
114
+
115
+ Licensed under [MIT](https://opensource.org/licenses/MIT).
package/dist/index.cjs ADDED
@@ -0,0 +1,95 @@
1
+ 'use strict';
2
+
3
+ var view = require('@codemirror/view');
4
+ var language = require('@codemirror/language');
5
+ var highlight = require('@lezer/highlight');
6
+
7
+ // Palenight theme color definitions
8
+ const base00 = '#292D3E', // Background
9
+ base01 = '#A6ACCD', // Foreground
10
+ base02 = '#444267', // Darker selection match
11
+ base03 = '#676E95', // Comments
12
+ base04 = '#A6ACCD', // Cursor color
13
+ base05 = '#C3E88D', // Green for strings and regex
14
+ base06 = '#33374D', // Line highlight
15
+ base07 = '#82AAFF', // Blue for keywords, type names, and operators
16
+ base08 = '#F78C6C'; // Orange for numbers, headings, and constants
17
+ const invalid = '#FF5370', // Red for invalid elements
18
+ darkBackground = base00, highlightBackground = base06, background = base00, // Main background
19
+ tooltipBackground = '#444267', selection = '#444267', cursor = base04; // Cursor color
20
+ // The editor theme styles for Palenight
21
+ const palenightTheme = view.EditorView.theme({
22
+ '&': {
23
+ color: base01,
24
+ backgroundColor: background,
25
+ },
26
+ '.cm-content': {
27
+ caretColor: cursor,
28
+ },
29
+ '.cm-cursor, .cm-dropCursor': {
30
+ borderLeftColor: cursor,
31
+ },
32
+ '&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': {
33
+ backgroundColor: selection,
34
+ },
35
+ '.cm-panels': {
36
+ backgroundColor: darkBackground,
37
+ color: base03,
38
+ },
39
+ '.cm-activeLine': {
40
+ backgroundColor: highlightBackground,
41
+ },
42
+ '.cm-selectionMatch': {
43
+ backgroundColor: base02,
44
+ },
45
+ '&.cm-focused .cm-matchingBracket': {
46
+ backgroundColor: highlightBackground,
47
+ },
48
+ '.cm-gutters': {
49
+ backgroundColor: darkBackground,
50
+ color: base03,
51
+ border: 'none',
52
+ },
53
+ '.cm-tooltip': {
54
+ backgroundColor: tooltipBackground,
55
+ },
56
+ }, { dark: true });
57
+ // The highlighting style for Palenight
58
+ const palenightHighlightStyle = language.HighlightStyle.define([
59
+ { tag: highlight.tags.keyword, color: base07 },
60
+ { tag: [highlight.tags.name, highlight.tags.deleted, highlight.tags.character, highlight.tags.macroName], color: base01 },
61
+ { tag: [highlight.tags.propertyName], color: base01 },
62
+ {
63
+ tag: [highlight.tags.processingInstruction, highlight.tags.string, highlight.tags.inserted, highlight.tags.special(highlight.tags.string)],
64
+ color: base05,
65
+ },
66
+ { tag: [highlight.tags.function(highlight.tags.variableName), highlight.tags.labelName], color: base01 },
67
+ { tag: [highlight.tags.color, highlight.tags.constant(highlight.tags.name), highlight.tags.standard(highlight.tags.name)], color: base01 },
68
+ { tag: [highlight.tags.definition(highlight.tags.name), highlight.tags.separator], color: base01 },
69
+ { tag: [highlight.tags.className], color: base01 },
70
+ {
71
+ tag: [highlight.tags.number, highlight.tags.changed, highlight.tags.annotation, highlight.tags.modifier, highlight.tags.self, highlight.tags.namespace],
72
+ color: base08,
73
+ },
74
+ { tag: [highlight.tags.typeName], color: base07 },
75
+ { tag: [highlight.tags.operator, highlight.tags.operatorKeyword], color: base07 },
76
+ { tag: [highlight.tags.url, highlight.tags.escape, highlight.tags.regexp, highlight.tags.link], color: base05 },
77
+ { tag: [highlight.tags.meta, highlight.tags.comment], color: base03 },
78
+ { tag: highlight.tags.tagName, color: base07 },
79
+ { tag: highlight.tags.strong, fontWeight: 'bold' },
80
+ { tag: highlight.tags.emphasis, fontStyle: 'italic' },
81
+ { tag: highlight.tags.link, textDecoration: 'underline' },
82
+ { tag: highlight.tags.heading, fontWeight: 'bold', color: base08 },
83
+ { tag: [highlight.tags.atom, highlight.tags.bool, highlight.tags.special(highlight.tags.variableName)], color: base01 },
84
+ { tag: highlight.tags.invalid, color: invalid },
85
+ { tag: highlight.tags.strikethrough, textDecoration: 'line-through' },
86
+ ]);
87
+ // Extension to enable the Palenight theme (both editor theme and highlight style)
88
+ const palenight = [
89
+ palenightTheme,
90
+ language.syntaxHighlighting(palenightHighlightStyle),
91
+ ];
92
+
93
+ exports.palenight = palenight;
94
+ exports.palenightHighlightStyle = palenightHighlightStyle;
95
+ exports.palenightTheme = palenightTheme;
@@ -0,0 +1,8 @@
1
+ import { Extension } from '@codemirror/state';
2
+ import { HighlightStyle } from '@codemirror/language';
3
+
4
+ declare const palenightTheme: Extension;
5
+ declare const palenightHighlightStyle: HighlightStyle;
6
+ declare const palenight: Extension;
7
+
8
+ export { palenight, palenightHighlightStyle, palenightTheme };
@@ -0,0 +1,8 @@
1
+ import { Extension } from '@codemirror/state';
2
+ import { HighlightStyle } from '@codemirror/language';
3
+
4
+ declare const palenightTheme: Extension;
5
+ declare const palenightHighlightStyle: HighlightStyle;
6
+ declare const palenight: Extension;
7
+
8
+ export { palenight, palenightHighlightStyle, palenightTheme };
package/dist/index.js ADDED
@@ -0,0 +1,91 @@
1
+ import { EditorView } from '@codemirror/view';
2
+ import { HighlightStyle, syntaxHighlighting } from '@codemirror/language';
3
+ import { tags } from '@lezer/highlight';
4
+
5
+ // Palenight theme color definitions
6
+ const base00 = '#292D3E', // Background
7
+ base01 = '#A6ACCD', // Foreground
8
+ base02 = '#444267', // Darker selection match
9
+ base03 = '#676E95', // Comments
10
+ base04 = '#A6ACCD', // Cursor color
11
+ base05 = '#C3E88D', // Green for strings and regex
12
+ base06 = '#33374D', // Line highlight
13
+ base07 = '#82AAFF', // Blue for keywords, type names, and operators
14
+ base08 = '#F78C6C'; // Orange for numbers, headings, and constants
15
+ const invalid = '#FF5370', // Red for invalid elements
16
+ darkBackground = base00, highlightBackground = base06, background = base00, // Main background
17
+ tooltipBackground = '#444267', selection = '#444267', cursor = base04; // Cursor color
18
+ // The editor theme styles for Palenight
19
+ const palenightTheme = /*@__PURE__*/EditorView.theme({
20
+ '&': {
21
+ color: base01,
22
+ backgroundColor: background,
23
+ },
24
+ '.cm-content': {
25
+ caretColor: cursor,
26
+ },
27
+ '.cm-cursor, .cm-dropCursor': {
28
+ borderLeftColor: cursor,
29
+ },
30
+ '&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': {
31
+ backgroundColor: selection,
32
+ },
33
+ '.cm-panels': {
34
+ backgroundColor: darkBackground,
35
+ color: base03,
36
+ },
37
+ '.cm-activeLine': {
38
+ backgroundColor: highlightBackground,
39
+ },
40
+ '.cm-selectionMatch': {
41
+ backgroundColor: base02,
42
+ },
43
+ '&.cm-focused .cm-matchingBracket': {
44
+ backgroundColor: highlightBackground,
45
+ },
46
+ '.cm-gutters': {
47
+ backgroundColor: darkBackground,
48
+ color: base03,
49
+ border: 'none',
50
+ },
51
+ '.cm-tooltip': {
52
+ backgroundColor: tooltipBackground,
53
+ },
54
+ }, { dark: true });
55
+ // The highlighting style for Palenight
56
+ const palenightHighlightStyle = /*@__PURE__*/HighlightStyle.define([
57
+ { tag: tags.keyword, color: base07 },
58
+ { tag: [tags.name, tags.deleted, tags.character, tags.macroName], color: base01 },
59
+ { tag: [tags.propertyName], color: base01 },
60
+ {
61
+ tag: [tags.processingInstruction, tags.string, tags.inserted, /*@__PURE__*/tags.special(tags.string)],
62
+ color: base05,
63
+ },
64
+ { tag: [/*@__PURE__*/tags.function(tags.variableName), tags.labelName], color: base01 },
65
+ { tag: [tags.color, /*@__PURE__*/tags.constant(tags.name), /*@__PURE__*/tags.standard(tags.name)], color: base01 },
66
+ { tag: [/*@__PURE__*/tags.definition(tags.name), tags.separator], color: base01 },
67
+ { tag: [tags.className], color: base01 },
68
+ {
69
+ tag: [tags.number, tags.changed, tags.annotation, tags.modifier, tags.self, tags.namespace],
70
+ color: base08,
71
+ },
72
+ { tag: [tags.typeName], color: base07 },
73
+ { tag: [tags.operator, tags.operatorKeyword], color: base07 },
74
+ { tag: [tags.url, tags.escape, tags.regexp, tags.link], color: base05 },
75
+ { tag: [tags.meta, tags.comment], color: base03 },
76
+ { tag: tags.tagName, color: base07 },
77
+ { tag: tags.strong, fontWeight: 'bold' },
78
+ { tag: tags.emphasis, fontStyle: 'italic' },
79
+ { tag: tags.link, textDecoration: 'underline' },
80
+ { tag: tags.heading, fontWeight: 'bold', color: base08 },
81
+ { tag: [tags.atom, tags.bool, /*@__PURE__*/tags.special(tags.variableName)], color: base01 },
82
+ { tag: tags.invalid, color: invalid },
83
+ { tag: tags.strikethrough, textDecoration: 'line-through' },
84
+ ]);
85
+ // Extension to enable the Palenight theme (both editor theme and highlight style)
86
+ const palenight = [
87
+ palenightTheme,
88
+ /*@__PURE__*/syntaxHighlighting(palenightHighlightStyle),
89
+ ];
90
+
91
+ export { palenight, palenightHighlightStyle, palenightTheme };
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@fsegurai/codemirror-theme-palenight",
3
+ "description": "Palenight theme for the CodeMirror code editor",
4
+ "version": "6.1.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.2"
44
+ }
45
+ }