@fsegurai/codemirror-theme-one-dark 0.0.0-stage → 6.4.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 fsegurai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,131 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <img alt="CodeMirror 6 Themes Logo" src="https://raw.githubusercontent.com/fsegurai/codemirror-themes/main/demo/public/codemirror-themes.svg">
3
+ </p>
2
4
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
5
+ <p align="center">
6
+ <a href="https://github.com/fsegurai/codemirror-themes">
7
+ <img src="https://img.shields.io/azure-devops/build/fsegurai/Libraries%2520NodeJs/16/main?label=Build%20Status&"
8
+ alt="Test Status">
9
+ </a>
10
+ <a href="https://www.npmjs.org/package/@fsegurai/codemirror-theme-one-dark">
11
+ <img src="https://img.shields.io/npm/v/@fsegurai/codemirror-theme-one-dark.svg"
12
+ alt="Latest Release">
13
+ </a>
14
+ <a href="https://www.npmjs.com/package/@fsegurai/codemirror-theme-one-dark">
15
+ <img src="https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-one-dark"
16
+ alt="Total npm downloads">
17
+ </a>
18
+ <br>
19
+ <img alt="GitHub contributors" src="https://img.shields.io/github/contributors/fsegurai/codemirror-themes">
20
+ <img alt="Dependency status for repo" src="https://img.shields.io/librariesio/github/fsegurai/codemirror-themes">
21
+ <a href="https://opensource.org/licenses/MIT">
22
+ <img alt="GitHub License" src="https://img.shields.io/github/license/fsegurai/codemirror-themes">
23
+ </a>
24
+ <br>
25
+ <img alt="Stars" src="https://img.shields.io/github/stars/fsegurai/codemirror-themes?style=square&labelColor=343b41"/>
26
+ <img alt="Forks" src="https://img.shields.io/github/forks/fsegurai/codemirror-themes?style=square&labelColor=343b41"/>
27
+ </p>
28
+
29
+ **A library of custom themes for CodeMirror 6.**
30
+
31
+ `@fsegurai/codemirror-theme-one-dark` is a theme for CodeMirror 6 editor, making it visually engaging and adaptable to different coding styles and user preferences.
32
+
33
+ ### Table of contents
34
+
35
+ - [Installation](#installation)
36
+ - [@fsegurai/codemirror-theme-one-dark](#@fsegurai/codemirror-theme-one-dark)
37
+ - [Using Theme](#using-theme)
38
+ - [More Resources](#more-resources)
39
+ - [Available Themes](#available-themes)
40
+ - [Demo Application](#demo-application)
41
+ - [License](#license)
42
+
43
+ ## Installation
44
+
45
+ ### @fsegurai/codemirror-theme-one-dark
46
+
47
+ To add `@fsegurai/codemirror-theme-one-dark` along with CodeMirror 6 to your `package.json` use the following commands.
48
+
49
+ ```bash
50
+ bun install @fsegurai/codemirror-theme-one-dark codemirror@^6.0.0 --save
51
+ ```
52
+
53
+ ## Using Theme
54
+
55
+ Import the respective theme from the package and apply it to your CodeMirror instance as shown below.
56
+
57
+ ```javascript
58
+ import { EditorView, basicSetup } from 'codemirror'
59
+ import { markdown } from '@codemirror/lang-markdown'
60
+ import { oneDark } from '@fsegurai/codemirror-theme-one-dark'
61
+
62
+ let editor = new EditorView({
63
+ doc: '# Hello World',
64
+ extensions: [
65
+ basicSetup,
66
+ markdown(),
67
+ oneDark
68
+ ],
69
+ parent: document.body
70
+ })
71
+ ```
72
+
73
+ Read the [CodeMirror documentation](https://codemirror.net/6/examples/styling/) for more details about themes.
74
+
75
+ ### Available Themes
76
+
77
+ | Theme | Package | Version | Downloads |
78
+ |-------|---------|---------|-----------|
79
+ | Abcdef | [@fsegurai/codemirror-theme-abcdef](https://www.npmjs.com/package/@fsegurai/codemirror-theme-abcdef) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-abcdef) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-abcdef) |
80
+ | Abyss | [@fsegurai/codemirror-theme-abyss](https://www.npmjs.com/package/@fsegurai/codemirror-theme-abyss) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-abyss) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-abyss) |
81
+ | Android Studio | [@fsegurai/codemirror-theme-android-studio](https://www.npmjs.com/package/@fsegurai/codemirror-theme-android-studio) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-android-studio) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-android-studio) |
82
+ | Andromeda | [@fsegurai/codemirror-theme-andromeda](https://www.npmjs.com/package/@fsegurai/codemirror-theme-andromeda) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-andromeda) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-andromeda) |
83
+ | Basic Dark | [@fsegurai/codemirror-theme-basic-dark](https://www.npmjs.com/package/@fsegurai/codemirror-theme-basic-dark) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-basic-dark) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-basic-dark) |
84
+ | Basic Light | [@fsegurai/codemirror-theme-basic-light](https://www.npmjs.com/package/@fsegurai/codemirror-theme-basic-light) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-basic-light) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-basic-light) |
85
+ | All - Bundle | [@fsegurai/codemirror-theme-bundle](https://www.npmjs.com/package/@fsegurai/codemirror-theme-bundle) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-bundle) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-bundle) |
86
+ | Catppuccin Latte | [@fsegurai/codemirror-theme-catppuccin-latte](https://www.npmjs.com/package/@fsegurai/codemirror-theme-catppuccin-latte) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-catppuccin-latte) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-catppuccin-latte) |
87
+ | Catppuccin Mocha | [@fsegurai/codemirror-theme-catppuccin-mocha](https://www.npmjs.com/package/@fsegurai/codemirror-theme-catppuccin-mocha) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-catppuccin-mocha) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-catppuccin-mocha) |
88
+ | Cobalt2 | [@fsegurai/codemirror-theme-cobalt2](https://www.npmjs.com/package/@fsegurai/codemirror-theme-cobalt2) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-cobalt2) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-cobalt2) |
89
+ | Dracula | [@fsegurai/codemirror-theme-dracula](https://www.npmjs.com/package/@fsegurai/codemirror-theme-dracula) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-dracula) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-dracula) |
90
+ | Forest | [@fsegurai/codemirror-theme-forest](https://www.npmjs.com/package/@fsegurai/codemirror-theme-forest) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-forest) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-forest) |
91
+ | GitHub Dark | [@fsegurai/codemirror-theme-github-dark](https://www.npmjs.com/package/@fsegurai/codemirror-theme-github-dark) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-github-dark) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-github-dark) |
92
+ | GitHub Light | [@fsegurai/codemirror-theme-github-light](https://www.npmjs.com/package/@fsegurai/codemirror-theme-github-light) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-github-light) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-github-light) |
93
+ | Gruvbox Dark | [@fsegurai/codemirror-theme-gruvbox-dark](https://www.npmjs.com/package/@fsegurai/codemirror-theme-gruvbox-dark) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-gruvbox-dark) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-gruvbox-dark) |
94
+ | Gruvbox Light | [@fsegurai/codemirror-theme-gruvbox-light](https://www.npmjs.com/package/@fsegurai/codemirror-theme-gruvbox-light) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-gruvbox-light) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-gruvbox-light) |
95
+ | High Contrast Dark | [@fsegurai/codemirror-theme-high-contrast-dark](https://www.npmjs.com/package/@fsegurai/codemirror-theme-high-contrast-dark) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-high-contrast-dark) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-high-contrast-dark) |
96
+ | High Contrast Light | [@fsegurai/codemirror-theme-high-contrast-light](https://www.npmjs.com/package/@fsegurai/codemirror-theme-high-contrast-light) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-high-contrast-light) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-high-contrast-light) |
97
+ | Material Dark | [@fsegurai/codemirror-theme-material-dark](https://www.npmjs.com/package/@fsegurai/codemirror-theme-material-dark) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-material-dark) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-material-dark) |
98
+ | Material Light | [@fsegurai/codemirror-theme-material-light](https://www.npmjs.com/package/@fsegurai/codemirror-theme-material-light) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-material-light) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-material-light) |
99
+ | Material Ocean | [@fsegurai/codemirror-theme-material-ocean](https://www.npmjs.com/package/@fsegurai/codemirror-theme-material-ocean) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-material-ocean) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-material-ocean) |
100
+ | Monokai | [@fsegurai/codemirror-theme-monokai](https://www.npmjs.com/package/@fsegurai/codemirror-theme-monokai) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-monokai) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-monokai) |
101
+ | Nord | [@fsegurai/codemirror-theme-nord](https://www.npmjs.com/package/@fsegurai/codemirror-theme-nord) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-nord) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-nord) |
102
+ | One Dark | [@fsegurai/codemirror-theme-one-dark](https://www.npmjs.com/package/@fsegurai/codemirror-theme-one-dark) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-one-dark) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-one-dark) |
103
+ | Palenight | [@fsegurai/codemirror-theme-palenight](https://www.npmjs.com/package/@fsegurai/codemirror-theme-palenight) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-palenight) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-palenight) |
104
+ | Rosé Pine Dawn | [@fsegurai/codemirror-theme-rose-pine-dawn](https://www.npmjs.com/package/@fsegurai/codemirror-theme-rose-pine-dawn) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-rose-pine-dawn) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-rose-pine-dawn) |
105
+ | Solarized Dark | [@fsegurai/codemirror-theme-solarized-dark](https://www.npmjs.com/package/@fsegurai/codemirror-theme-solarized-dark) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-solarized-dark) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-solarized-dark) |
106
+ | Solarized Light | [@fsegurai/codemirror-theme-solarized-light](https://www.npmjs.com/package/@fsegurai/codemirror-theme-solarized-light) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-solarized-light) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-solarized-light) |
107
+ | Synthwave 84 | [@fsegurai/codemirror-theme-synthwave-84](https://www.npmjs.com/package/@fsegurai/codemirror-theme-synthwave-84) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-synthwave-84) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-synthwave-84) |
108
+ | Tokyo Night Day | [@fsegurai/codemirror-theme-tokyo-night-day](https://www.npmjs.com/package/@fsegurai/codemirror-theme-tokyo-night-day) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-tokyo-night-day) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-tokyo-night-day) |
109
+ | Tokyo Night Storm | [@fsegurai/codemirror-theme-tokyo-night-storm](https://www.npmjs.com/package/@fsegurai/codemirror-theme-tokyo-night-storm) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-tokyo-night-storm) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-tokyo-night-storm) |
110
+ | Volcano | [@fsegurai/codemirror-theme-volcano](https://www.npmjs.com/package/@fsegurai/codemirror-theme-volcano) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-volcano) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-volcano) |
111
+ | VS Code Dark | [@fsegurai/codemirror-theme-vscode-dark](https://www.npmjs.com/package/@fsegurai/codemirror-theme-vscode-dark) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-vscode-dark) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-vscode-dark) |
112
+ | VS Code Light | [@fsegurai/codemirror-theme-vscode-light](https://www.npmjs.com/package/@fsegurai/codemirror-theme-vscode-light) | ![npm](https://img.shields.io/npm/v/@fsegurai/codemirror-theme-vscode-light) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/codemirror-theme-vscode-light) |
113
+
114
+ ## Demo Application
115
+
116
+ To see all themes in action, check out the
117
+ demo: [https://fsegurai.github.io/codemirror-themes](https://fsegurai.github.io/codemirror-themes).
118
+
119
+ To set up the demo locally:
120
+
121
+ ```bash
122
+ git clone https://github.com/fsegurai/codemirror-themes.git
123
+ bun install
124
+ bun start
125
+ ```
126
+
127
+ This will serve the application locally at [http://[::1]:8000](http://[::1]:8000).
128
+
129
+ ## License
130
+
131
+ Licensed under [MIT](https://opensource.org/licenses/MIT).
package/dist/index.cjs ADDED
@@ -0,0 +1,255 @@
1
+ 'use strict';
2
+
3
+ var codemirrorThemeCore = require('@fsegurai/codemirror-theme-core');
4
+
5
+ // Helper module for styling options
6
+ /**
7
+ * Function to apply merge revert styles for a theme
8
+ * @param styles Styles for the merge revert buttons
9
+ * @param styles.backgroundColor Background color of the revert area
10
+ * @param styles.borderColor Border color of the revert area
11
+ * @param styles.buttonColor Color of the revert buttons
12
+ * @param styles.buttonHoverColor Hover color of the revert buttons
13
+ */
14
+ function applyMergeRevertStyles(styles) {
15
+ // Create a stylesheet
16
+ const styleEl = document.createElement('style');
17
+ styleEl.id = 'cm-merge-revert-styles';
18
+ // Define CSS with the theme-specific values
19
+ styleEl.textContent = `
20
+ .cm-merge-revert {
21
+ display: flex;
22
+ flex-direction: column;
23
+ align-items: center;
24
+ justify-content: flex-start;
25
+ padding: 4px;
26
+ background-color: ${styles.backgroundColor};
27
+ border-left: 1px solid ${styles.borderColor};
28
+ border-right: 1px solid ${styles.borderColor};
29
+ width: 32px;
30
+ }
31
+
32
+ .cm-merge-revert button {
33
+ width: 100%;
34
+ height: auto;
35
+ background-color: transparent;
36
+ border: none;
37
+ color: ${styles.buttonColor};
38
+ cursor: pointer;
39
+ margin: 0 auto;
40
+ font-size: 20px;
41
+ }
42
+
43
+ .cm-merge-revert button:hover {
44
+ background-color: ${styles.buttonHoverColor};
45
+ }
46
+ `;
47
+ // Remove any existing merge styles
48
+ const existingStyle = document.getElementById('cm-merge-revert-styles');
49
+ if (existingStyle)
50
+ existingStyle.remove();
51
+ // Add the new styles
52
+ document.head.appendChild(styleEl);
53
+ }
54
+
55
+ /**
56
+ * One Dark theme color definitions
57
+ * --------------------------------
58
+ * Palette from Atom's One Dark syntax theme: https://github.com/atom/atom/tree/master/packages/one-dark-syntax
59
+ * (GitHub Inc., MIT License, https://github.com/atom/atom/blob/master/LICENSE.md).
60
+ * Colors below WCAG AA keep their hue and only shift lightness (OKLCH); the official value is noted next to them.
61
+ *
62
+ * Note: `@codemirror/theme-one-dark` also exports `oneDark`. When an app uses both packages, import one of them with
63
+ * an alias, e.g. `import { oneDark as fseguraiOneDark } from '@fsegurai/codemirror-theme-one-dark'`.
64
+ */
65
+ // Core palette (syntax variables `mono-*` and `hue-*`)
66
+ const background = '#282c34', // syntax-bg
67
+ foreground = '#abb2bf', // mono-1
68
+ mono2 = '#9fa6b5', // official #828997
69
+ mono3 = '#9fa6b5', // comments, official #5c6370
70
+ cyan = '#56b6c2', // hue-1
71
+ blue = '#61afef', // hue-2
72
+ purple = '#d688ee', // hue-3, official #c678dd
73
+ green = '#98c379', // hue-4
74
+ red = '#f9828a', // hue-5, official #e06c75
75
+ orange = '#d29b67', // hue-6, official #d19a66
76
+ gold = '#e5c07b'; // hue-6-2
77
+ // UI specific colors
78
+ const darkBackground = '#21252b', cursor = '#528bff', // syntax-cursor-color
79
+ selection = '#363c49', // syntax-selection-color, official #3e4451
80
+ activeLine = '#2c313c', // syntax-cursor-line
81
+ gutterForeground = '#8b93a6', // syntax-gutter-text-color, official #4b5263
82
+ tooltipBackground = '#353b45';
83
+ const theme = codemirrorThemeCore.defineTheme({
84
+ name: 'One Dark',
85
+ dark: true,
86
+ ui: {
87
+ background,
88
+ foreground,
89
+ border: 'none',
90
+ cursor,
91
+ cursorWidth: '2px',
92
+ cursorShadow: 'none',
93
+ fatCursor: { background: `${cursor}99`, border: 'none' },
94
+ selection,
95
+ selectionInactive: selection,
96
+ selectionForeground: null,
97
+ selectionOutline: 'none',
98
+ activeLine,
99
+ activeLineBorder: { left: 'none', right: 'none' },
100
+ ghostText: mono3,
101
+ ghostTextOpacity: '0.6',
102
+ specialChar: red,
103
+ focusRing: `0 0 0 2px ${background}, 0 0 0 4px ${blue}`,
104
+ outlineWidth: '1px',
105
+ searchMatch: {
106
+ background: `${blue}33`,
107
+ outline: blue,
108
+ foreground,
109
+ shadow: 'none',
110
+ selectedBackground: `${blue}66`,
111
+ selectedForeground: foreground,
112
+ selectedOutline: `1px solid ${blue}`,
113
+ selectedShadow: 'none',
114
+ },
115
+ selectionMatch: { background: '#aafe661a', outline: `${mono3}80` },
116
+ matchingBracket: { background: '#bad0f847', outline: foreground, shadow: 'none' },
117
+ nonMatchingBracket: { background: `${red}40`, outline: red },
118
+ panel: {
119
+ background: darkBackground,
120
+ foreground,
121
+ border: '#181a1f',
122
+ borderWidth: '1px',
123
+ outline: 'none',
124
+ shadow: 'none',
125
+ buttonBackground: tooltipBackground,
126
+ buttonForeground: foreground,
127
+ buttonBorder: 'none',
128
+ buttonHoverBackground: selection,
129
+ buttonHoverForeground: foreground,
130
+ buttonHoverBorder: 'none',
131
+ buttonHoverShadow: 'none',
132
+ inputBackground: background,
133
+ inputBorder: `1px solid ${selection}`,
134
+ },
135
+ gutter: {
136
+ background,
137
+ foreground: gutterForeground,
138
+ border: 'transparent',
139
+ activeBackground: activeLine,
140
+ activeForeground: foreground,
141
+ activeFontWeight: '500',
142
+ activeBorder: 'none',
143
+ foldHover: foreground,
144
+ },
145
+ foldPlaceholder: { background: 'transparent', foreground: mono2, border: `${mono3}70`, borderStyle: 'dotted' },
146
+ tooltip: {
147
+ background: tooltipBackground,
148
+ foreground,
149
+ border: '#181a1f',
150
+ shadow: '0 2px 8px rgba(0, 0, 0, 0.4)',
151
+ listBackground: tooltipBackground,
152
+ listBorder: 'none',
153
+ hoverBackground: selection,
154
+ selectedBackground: selection,
155
+ selectedForeground: foreground,
156
+ selectedBorder: 'none',
157
+ icon: blue,
158
+ detail: mono2,
159
+ },
160
+ diff: {
161
+ insertedBackground: `${green}26`,
162
+ insertedForeground: green,
163
+ insertedBorder: `1px solid ${green}40`,
164
+ deletedBackground: `${red}26`,
165
+ deletedForeground: red,
166
+ deletedBorder: `1px solid ${red}40`,
167
+ },
168
+ diagnostic: {
169
+ error: red,
170
+ warning: gold,
171
+ info: blue,
172
+ hint: cyan,
173
+ errorBackground: 'transparent',
174
+ warningBackground: 'transparent',
175
+ infoBackground: 'transparent',
176
+ borderWidth: '3px',
177
+ underlineWidth: '2px',
178
+ },
179
+ scrollbar: {
180
+ track: darkBackground,
181
+ trackBorder: 'none',
182
+ thumb: selection,
183
+ thumbBorder: `3px solid ${darkBackground}`,
184
+ thumbHover: gutterForeground,
185
+ thumbHoverShadow: 'none',
186
+ },
187
+ merge: {
188
+ backgroundColor: darkBackground,
189
+ borderColor: selection,
190
+ buttonColor: foreground,
191
+ buttonHoverColor: selection,
192
+ },
193
+ },
194
+ syntax: {
195
+ keyword: { color: purple },
196
+ definitionKeyword: { color: purple },
197
+ modifier: { color: purple },
198
+ separator: { color: foreground },
199
+ angleBracket: { color: foreground },
200
+ squareBracket: { color: foreground },
201
+ brace: { color: foreground },
202
+ operator: { color: cyan },
203
+ punctuation: { color: foreground },
204
+ name: { color: red },
205
+ localVariable: { color: red },
206
+ variableDefinition: { color: red },
207
+ nameDefinition: { color: red },
208
+ function: { color: blue },
209
+ self: { color: red, fontStyle: 'italic' },
210
+ label: { color: red },
211
+ property: { color: red },
212
+ type: { color: gold },
213
+ typeDefinition: { color: gold },
214
+ className: { color: gold },
215
+ namespace: { color: gold },
216
+ tag: { color: red },
217
+ attribute: { color: orange },
218
+ content: { color: foreground },
219
+ string: { color: green },
220
+ regexp: { color: cyan },
221
+ number: { color: orange },
222
+ constant: { color: orange },
223
+ comment: { color: mono3, fontStyle: 'italic' },
224
+ meta: { color: mono2 },
225
+ processingInstruction: { color: purple },
226
+ annotation: { color: gold },
227
+ heading: { color: red, fontWeight: 'bold' },
228
+ headingLevel: { color: red },
229
+ list: { color: red },
230
+ quote: { color: mono3, fontStyle: 'italic' },
231
+ monospace: { color: green },
232
+ contentSeparator: { color: mono3 },
233
+ link: { color: blue, textDecoration: 'underline', textUnderlinePosition: 'under' },
234
+ url: { color: cyan, textDecoration: 'underline', textUnderlineOffset: '2px' },
235
+ emphasis: { color: purple, fontStyle: 'italic' },
236
+ strong: { color: orange, fontWeight: 'bold' },
237
+ strikethrough: { textDecoration: 'line-through' },
238
+ invalid: { color: red, textDecoration: 'underline wavy', borderBottom: `1px wavy ${red}` },
239
+ inserted: { color: green },
240
+ deleted: { color: red },
241
+ changed: { color: gold },
242
+ },
243
+ });
244
+ /**
245
+ * Combined One Dark theme extension
246
+ */
247
+ const oneDark = theme.extension;
248
+ /**
249
+ * One Dark merge revert styles configuration
250
+ */
251
+ const oneDarkMergeStyles = theme.mergeStyles;
252
+
253
+ exports.applyMergeRevertStyles = applyMergeRevertStyles;
254
+ exports.oneDark = oneDark;
255
+ exports.oneDarkMergeStyles = oneDarkMergeStyles;
@@ -0,0 +1,28 @@
1
+ import { Extension } from '@codemirror/state';
2
+
3
+ interface IMergeRevertStyles {
4
+ backgroundColor: string;
5
+ borderColor: string;
6
+ buttonColor: string;
7
+ buttonHoverColor: string;
8
+ }
9
+ /**
10
+ * Function to apply merge revert styles for a theme
11
+ * @param styles Styles for the merge revert buttons
12
+ * @param styles.backgroundColor Background color of the revert area
13
+ * @param styles.borderColor Border color of the revert area
14
+ * @param styles.buttonColor Color of the revert buttons
15
+ * @param styles.buttonHoverColor Hover color of the revert buttons
16
+ */
17
+ declare function applyMergeRevertStyles(styles: IMergeRevertStyles): void;
18
+
19
+ /**
20
+ * Combined One Dark theme extension
21
+ */
22
+ declare const oneDark: Extension;
23
+ /**
24
+ * One Dark merge revert styles configuration
25
+ */
26
+ declare const oneDarkMergeStyles: IMergeRevertStyles;
27
+
28
+ export { applyMergeRevertStyles, oneDark, oneDarkMergeStyles };
@@ -0,0 +1,28 @@
1
+ import { Extension } from '@codemirror/state';
2
+
3
+ interface IMergeRevertStyles {
4
+ backgroundColor: string;
5
+ borderColor: string;
6
+ buttonColor: string;
7
+ buttonHoverColor: string;
8
+ }
9
+ /**
10
+ * Function to apply merge revert styles for a theme
11
+ * @param styles Styles for the merge revert buttons
12
+ * @param styles.backgroundColor Background color of the revert area
13
+ * @param styles.borderColor Border color of the revert area
14
+ * @param styles.buttonColor Color of the revert buttons
15
+ * @param styles.buttonHoverColor Hover color of the revert buttons
16
+ */
17
+ declare function applyMergeRevertStyles(styles: IMergeRevertStyles): void;
18
+
19
+ /**
20
+ * Combined One Dark theme extension
21
+ */
22
+ declare const oneDark: Extension;
23
+ /**
24
+ * One Dark merge revert styles configuration
25
+ */
26
+ declare const oneDarkMergeStyles: IMergeRevertStyles;
27
+
28
+ export { applyMergeRevertStyles, oneDark, oneDarkMergeStyles };
package/dist/index.js ADDED
@@ -0,0 +1,251 @@
1
+ import { defineTheme } from '@fsegurai/codemirror-theme-core';
2
+
3
+ // Helper module for styling options
4
+ /**
5
+ * Function to apply merge revert styles for a theme
6
+ * @param styles Styles for the merge revert buttons
7
+ * @param styles.backgroundColor Background color of the revert area
8
+ * @param styles.borderColor Border color of the revert area
9
+ * @param styles.buttonColor Color of the revert buttons
10
+ * @param styles.buttonHoverColor Hover color of the revert buttons
11
+ */
12
+ function applyMergeRevertStyles(styles) {
13
+ // Create a stylesheet
14
+ const styleEl = document.createElement('style');
15
+ styleEl.id = 'cm-merge-revert-styles';
16
+ // Define CSS with the theme-specific values
17
+ styleEl.textContent = `
18
+ .cm-merge-revert {
19
+ display: flex;
20
+ flex-direction: column;
21
+ align-items: center;
22
+ justify-content: flex-start;
23
+ padding: 4px;
24
+ background-color: ${styles.backgroundColor};
25
+ border-left: 1px solid ${styles.borderColor};
26
+ border-right: 1px solid ${styles.borderColor};
27
+ width: 32px;
28
+ }
29
+
30
+ .cm-merge-revert button {
31
+ width: 100%;
32
+ height: auto;
33
+ background-color: transparent;
34
+ border: none;
35
+ color: ${styles.buttonColor};
36
+ cursor: pointer;
37
+ margin: 0 auto;
38
+ font-size: 20px;
39
+ }
40
+
41
+ .cm-merge-revert button:hover {
42
+ background-color: ${styles.buttonHoverColor};
43
+ }
44
+ `;
45
+ // Remove any existing merge styles
46
+ const existingStyle = document.getElementById('cm-merge-revert-styles');
47
+ if (existingStyle)
48
+ existingStyle.remove();
49
+ // Add the new styles
50
+ document.head.appendChild(styleEl);
51
+ }
52
+
53
+ /**
54
+ * One Dark theme color definitions
55
+ * --------------------------------
56
+ * Palette from Atom's One Dark syntax theme: https://github.com/atom/atom/tree/master/packages/one-dark-syntax
57
+ * (GitHub Inc., MIT License, https://github.com/atom/atom/blob/master/LICENSE.md).
58
+ * Colors below WCAG AA keep their hue and only shift lightness (OKLCH); the official value is noted next to them.
59
+ *
60
+ * Note: `@codemirror/theme-one-dark` also exports `oneDark`. When an app uses both packages, import one of them with
61
+ * an alias, e.g. `import { oneDark as fseguraiOneDark } from '@fsegurai/codemirror-theme-one-dark'`.
62
+ */
63
+ // Core palette (syntax variables `mono-*` and `hue-*`)
64
+ const background = '#282c34', // syntax-bg
65
+ foreground = '#abb2bf', // mono-1
66
+ mono2 = '#9fa6b5', // official #828997
67
+ mono3 = '#9fa6b5', // comments, official #5c6370
68
+ cyan = '#56b6c2', // hue-1
69
+ blue = '#61afef', // hue-2
70
+ purple = '#d688ee', // hue-3, official #c678dd
71
+ green = '#98c379', // hue-4
72
+ red = '#f9828a', // hue-5, official #e06c75
73
+ orange = '#d29b67', // hue-6, official #d19a66
74
+ gold = '#e5c07b'; // hue-6-2
75
+ // UI specific colors
76
+ const darkBackground = '#21252b', cursor = '#528bff', // syntax-cursor-color
77
+ selection = '#363c49', // syntax-selection-color, official #3e4451
78
+ activeLine = '#2c313c', // syntax-cursor-line
79
+ gutterForeground = '#8b93a6', // syntax-gutter-text-color, official #4b5263
80
+ tooltipBackground = '#353b45';
81
+ const theme = /*@__PURE__*/defineTheme({
82
+ name: 'One Dark',
83
+ dark: true,
84
+ ui: {
85
+ background,
86
+ foreground,
87
+ border: 'none',
88
+ cursor,
89
+ cursorWidth: '2px',
90
+ cursorShadow: 'none',
91
+ fatCursor: { background: `${cursor}99`, border: 'none' },
92
+ selection,
93
+ selectionInactive: selection,
94
+ selectionForeground: null,
95
+ selectionOutline: 'none',
96
+ activeLine,
97
+ activeLineBorder: { left: 'none', right: 'none' },
98
+ ghostText: mono3,
99
+ ghostTextOpacity: '0.6',
100
+ specialChar: red,
101
+ focusRing: `0 0 0 2px ${background}, 0 0 0 4px ${blue}`,
102
+ outlineWidth: '1px',
103
+ searchMatch: {
104
+ background: `${blue}33`,
105
+ outline: blue,
106
+ foreground,
107
+ shadow: 'none',
108
+ selectedBackground: `${blue}66`,
109
+ selectedForeground: foreground,
110
+ selectedOutline: `1px solid ${blue}`,
111
+ selectedShadow: 'none',
112
+ },
113
+ selectionMatch: { background: '#aafe661a', outline: `${mono3}80` },
114
+ matchingBracket: { background: '#bad0f847', outline: foreground, shadow: 'none' },
115
+ nonMatchingBracket: { background: `${red}40`, outline: red },
116
+ panel: {
117
+ background: darkBackground,
118
+ foreground,
119
+ border: '#181a1f',
120
+ borderWidth: '1px',
121
+ outline: 'none',
122
+ shadow: 'none',
123
+ buttonBackground: tooltipBackground,
124
+ buttonForeground: foreground,
125
+ buttonBorder: 'none',
126
+ buttonHoverBackground: selection,
127
+ buttonHoverForeground: foreground,
128
+ buttonHoverBorder: 'none',
129
+ buttonHoverShadow: 'none',
130
+ inputBackground: background,
131
+ inputBorder: `1px solid ${selection}`,
132
+ },
133
+ gutter: {
134
+ background,
135
+ foreground: gutterForeground,
136
+ border: 'transparent',
137
+ activeBackground: activeLine,
138
+ activeForeground: foreground,
139
+ activeFontWeight: '500',
140
+ activeBorder: 'none',
141
+ foldHover: foreground,
142
+ },
143
+ foldPlaceholder: { background: 'transparent', foreground: mono2, border: `${mono3}70`, borderStyle: 'dotted' },
144
+ tooltip: {
145
+ background: tooltipBackground,
146
+ foreground,
147
+ border: '#181a1f',
148
+ shadow: '0 2px 8px rgba(0, 0, 0, 0.4)',
149
+ listBackground: tooltipBackground,
150
+ listBorder: 'none',
151
+ hoverBackground: selection,
152
+ selectedBackground: selection,
153
+ selectedForeground: foreground,
154
+ selectedBorder: 'none',
155
+ icon: blue,
156
+ detail: mono2,
157
+ },
158
+ diff: {
159
+ insertedBackground: `${green}26`,
160
+ insertedForeground: green,
161
+ insertedBorder: `1px solid ${green}40`,
162
+ deletedBackground: `${red}26`,
163
+ deletedForeground: red,
164
+ deletedBorder: `1px solid ${red}40`,
165
+ },
166
+ diagnostic: {
167
+ error: red,
168
+ warning: gold,
169
+ info: blue,
170
+ hint: cyan,
171
+ errorBackground: 'transparent',
172
+ warningBackground: 'transparent',
173
+ infoBackground: 'transparent',
174
+ borderWidth: '3px',
175
+ underlineWidth: '2px',
176
+ },
177
+ scrollbar: {
178
+ track: darkBackground,
179
+ trackBorder: 'none',
180
+ thumb: selection,
181
+ thumbBorder: `3px solid ${darkBackground}`,
182
+ thumbHover: gutterForeground,
183
+ thumbHoverShadow: 'none',
184
+ },
185
+ merge: {
186
+ backgroundColor: darkBackground,
187
+ borderColor: selection,
188
+ buttonColor: foreground,
189
+ buttonHoverColor: selection,
190
+ },
191
+ },
192
+ syntax: {
193
+ keyword: { color: purple },
194
+ definitionKeyword: { color: purple },
195
+ modifier: { color: purple },
196
+ separator: { color: foreground },
197
+ angleBracket: { color: foreground },
198
+ squareBracket: { color: foreground },
199
+ brace: { color: foreground },
200
+ operator: { color: cyan },
201
+ punctuation: { color: foreground },
202
+ name: { color: red },
203
+ localVariable: { color: red },
204
+ variableDefinition: { color: red },
205
+ nameDefinition: { color: red },
206
+ function: { color: blue },
207
+ self: { color: red, fontStyle: 'italic' },
208
+ label: { color: red },
209
+ property: { color: red },
210
+ type: { color: gold },
211
+ typeDefinition: { color: gold },
212
+ className: { color: gold },
213
+ namespace: { color: gold },
214
+ tag: { color: red },
215
+ attribute: { color: orange },
216
+ content: { color: foreground },
217
+ string: { color: green },
218
+ regexp: { color: cyan },
219
+ number: { color: orange },
220
+ constant: { color: orange },
221
+ comment: { color: mono3, fontStyle: 'italic' },
222
+ meta: { color: mono2 },
223
+ processingInstruction: { color: purple },
224
+ annotation: { color: gold },
225
+ heading: { color: red, fontWeight: 'bold' },
226
+ headingLevel: { color: red },
227
+ list: { color: red },
228
+ quote: { color: mono3, fontStyle: 'italic' },
229
+ monospace: { color: green },
230
+ contentSeparator: { color: mono3 },
231
+ link: { color: blue, textDecoration: 'underline', textUnderlinePosition: 'under' },
232
+ url: { color: cyan, textDecoration: 'underline', textUnderlineOffset: '2px' },
233
+ emphasis: { color: purple, fontStyle: 'italic' },
234
+ strong: { color: orange, fontWeight: 'bold' },
235
+ strikethrough: { textDecoration: 'line-through' },
236
+ invalid: { color: red, textDecoration: 'underline wavy', borderBottom: `1px wavy ${red}` },
237
+ inserted: { color: green },
238
+ deleted: { color: red },
239
+ changed: { color: gold },
240
+ },
241
+ });
242
+ /**
243
+ * Combined One Dark theme extension
244
+ */
245
+ const oneDark = theme.extension;
246
+ /**
247
+ * One Dark merge revert styles configuration
248
+ */
249
+ const oneDarkMergeStyles = theme.mergeStyles;
250
+
251
+ export { applyMergeRevertStyles, oneDark, oneDarkMergeStyles };
package/package.json CHANGED
@@ -1,6 +1,67 @@
1
1
  {
2
2
  "name": "@fsegurai/codemirror-theme-one-dark",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "6.4.0",
4
+ "description": "One Dark theme for the CodeMirror editor",
5
+ "type": "module",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ "import": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.cts",
16
+ "default": "./dist/index.cjs"
17
+ }
18
+ },
19
+ "sideEffects": false,
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "keywords": [
24
+ "editor",
25
+ "diff",
26
+ "diff-editor",
27
+ "code",
28
+ "codemirror",
29
+ "theme",
30
+ "themes",
31
+ "syntax",
32
+ "highlight",
33
+ "one-dark",
34
+ "onedark",
35
+ "atom",
36
+ "dark"
37
+ ],
38
+ "author": {
39
+ "name": "Fabián Segura",
40
+ "url": "https://www.fsegurai.com/"
41
+ },
42
+ "license": "MIT",
43
+ "scripts": {
44
+ "pkg:build": "cm-buildhelper src/index.ts",
45
+ "pkg:test": "cm-runtests"
46
+ },
47
+ "peerDependencies": {
48
+ "@lezer/highlight": "^1.0.0",
49
+ "@codemirror/language": "^6.0.0",
50
+ "@codemirror/state": "^6.0.0",
51
+ "@codemirror/view": "^6.0.0"
52
+ },
53
+ "dependencies": {
54
+ "@fsegurai/codemirror-theme-core": "6.0.0"
55
+ },
56
+ "devDependencies": {
57
+ "@codemirror/buildhelper": "^1.0.2"
58
+ },
59
+ "repository": {
60
+ "type": "git",
61
+ "url": "git+https://github.com/fsegurai/codemirror-themes.git"
62
+ },
63
+ "bugs": {
64
+ "url": "https://github.com/fsegurai/codemirror-themes/issues"
65
+ },
66
+ "homepage": "https://github.com/fsegurai/codemirror-themes#readme"
67
+ }