@fsegurai/codemirror-theme-cobalt2 6.0.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 +119 -0
- package/dist/index.cjs +602 -0
- package/dist/index.d.cts +28 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +598 -0
- package/package.json +52 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var view = require('@codemirror/view');
|
|
4
|
+
var language = require('@codemirror/language');
|
|
5
|
+
var highlight = require('@lezer/highlight');
|
|
6
|
+
|
|
7
|
+
// Helper module for styling options
|
|
8
|
+
const generalContent = {
|
|
9
|
+
fontSize: '14px',
|
|
10
|
+
fontFamily: 'JetBrains Mono, Consolas, monospace',
|
|
11
|
+
lineHeight: '1.6',
|
|
12
|
+
};
|
|
13
|
+
const generalCursor = {
|
|
14
|
+
borderLeftWidth: '2px',
|
|
15
|
+
};
|
|
16
|
+
const generalDiff = {
|
|
17
|
+
insertedTextDecoration: 'none',
|
|
18
|
+
deletedTextDecoration: 'line-through',
|
|
19
|
+
insertedLinePadding: '1px 3px',
|
|
20
|
+
borderRadious: '3px'};
|
|
21
|
+
const generalGutter = {
|
|
22
|
+
border: 'none',
|
|
23
|
+
paddingRight: '8px',
|
|
24
|
+
fontSize: '0.9em',
|
|
25
|
+
fontWeight: '500',
|
|
26
|
+
};
|
|
27
|
+
const generalPanel = {
|
|
28
|
+
borderRadius: '4px',
|
|
29
|
+
padding: '2px 10px',
|
|
30
|
+
};
|
|
31
|
+
const generalLine = {
|
|
32
|
+
borderRadius: '2px',
|
|
33
|
+
};
|
|
34
|
+
const generalMatching = {
|
|
35
|
+
borderRadius: '2px',
|
|
36
|
+
};
|
|
37
|
+
const generalPlaceholder = {
|
|
38
|
+
borderRadius: '4px',
|
|
39
|
+
padding: '0 5px',
|
|
40
|
+
margin: '0 2px',
|
|
41
|
+
};
|
|
42
|
+
const generalScroller = {
|
|
43
|
+
width: '12px',
|
|
44
|
+
height: '12px',
|
|
45
|
+
borderRadius: '6px',
|
|
46
|
+
};
|
|
47
|
+
const generalSearchField = {
|
|
48
|
+
borderRadius: '4px',
|
|
49
|
+
padding: '2px 6px',
|
|
50
|
+
};
|
|
51
|
+
const generalTooltip = {
|
|
52
|
+
borderRadius: '4px',
|
|
53
|
+
borderRadiusSelected: '3px',
|
|
54
|
+
lineHeight: '1.3',
|
|
55
|
+
padding: '4px 8px',
|
|
56
|
+
paddingRight: '8px',
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Function to apply merge revert styles for a theme
|
|
60
|
+
* @param styles Styles for the merge revert buttons
|
|
61
|
+
* @param styles.backgroundColor Background color of the revert area
|
|
62
|
+
* @param styles.borderColor Border color of the revert area
|
|
63
|
+
* @param styles.buttonColor Color of the revert buttons
|
|
64
|
+
* @param styles.buttonHoverColor Hover color of the revert buttons
|
|
65
|
+
*/
|
|
66
|
+
function applyMergeRevertStyles(styles) {
|
|
67
|
+
// Create a stylesheet
|
|
68
|
+
const styleEl = document.createElement('style');
|
|
69
|
+
styleEl.id = 'cm-merge-revert-styles';
|
|
70
|
+
// Define CSS with the theme-specific values
|
|
71
|
+
styleEl.textContent = `
|
|
72
|
+
.cm-merge-revert {
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-direction: column;
|
|
75
|
+
align-items: center;
|
|
76
|
+
justify-content: flex-start;
|
|
77
|
+
padding: 4px;
|
|
78
|
+
background-color: ${styles.backgroundColor};
|
|
79
|
+
border-left: 1px solid ${styles.borderColor};
|
|
80
|
+
border-right: 1px solid ${styles.borderColor};
|
|
81
|
+
width: 32px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.cm-merge-revert button {
|
|
85
|
+
width: 100%;
|
|
86
|
+
height: auto;
|
|
87
|
+
background-color: transparent;
|
|
88
|
+
border: none;
|
|
89
|
+
color: ${styles.buttonColor};
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
margin: 0 auto;
|
|
92
|
+
font-size: 20px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.cm-merge-revert button:hover {
|
|
96
|
+
background-color: ${styles.buttonHoverColor};
|
|
97
|
+
}
|
|
98
|
+
`;
|
|
99
|
+
// Remove any existing merge styles
|
|
100
|
+
const existingStyle = document.getElementById('cm-merge-revert-styles');
|
|
101
|
+
if (existingStyle)
|
|
102
|
+
existingStyle.remove();
|
|
103
|
+
// Add the new styles
|
|
104
|
+
document.head.appendChild(styleEl);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Cobalt2 theme color palette
|
|
109
|
+
* ---------------------------------------------------------------------
|
|
110
|
+
* Colors are organized by function with visual color blocks for quick reference
|
|
111
|
+
*/
|
|
112
|
+
// Base colors from the original Cobalt2 theme (exact match)
|
|
113
|
+
const background = '#193549', // Main editor background
|
|
114
|
+
foreground = '#fff', // Main text color (exact from original)
|
|
115
|
+
cursor = '#ffc600', // Cursor color (bright yellow)
|
|
116
|
+
selection = '#0050A4', // Selection background
|
|
117
|
+
selectionInactive = '#003b8b', // Inactive selection
|
|
118
|
+
selectionHighlight = '#0050A480', // Selection highlights (with transparency)
|
|
119
|
+
lineHighlight = '#99eeff33', // The current line highlights
|
|
120
|
+
// UI backgrounds (exact from original)
|
|
121
|
+
darkBackground = '#122738', // Sidebar, panels, gutter
|
|
122
|
+
panelBackground = '#15232d', // Panel background
|
|
123
|
+
gutterBackground = '#12273866', // Gutter background with transparency
|
|
124
|
+
// Searches and finds colors (exact from original)
|
|
125
|
+
findMatchCurrent = '#FF720066', // Currently found item
|
|
126
|
+
findMatchOther = '#CAD40F66', // Other found items
|
|
127
|
+
hoverHighlight = '#ffc60033', // Hover highlight
|
|
128
|
+
// Word highlights (exact from original)
|
|
129
|
+
wordHighlight = '#ffffff21', // Word highlight background
|
|
130
|
+
// Accent colors from tokenColors (exact from original)
|
|
131
|
+
blue = '#0088ff', // Comments, links
|
|
132
|
+
cyan = '#80fcff', // Special keywords, module exports
|
|
133
|
+
lightBlue = '#9effff', // Meta, variables, properties
|
|
134
|
+
yellow = '#ffc600', // Entities, storage, functions
|
|
135
|
+
orange = '#ff9d00', // Keywords, support functions
|
|
136
|
+
pink = '#ff628c', // Constants, deleted text
|
|
137
|
+
hotPink = '#fb94ff', // Language variables, storage.type.function
|
|
138
|
+
lightPink = '#FF68B8', // Types, interfaces (semantic)
|
|
139
|
+
green = '#3ad900', // Template strings
|
|
140
|
+
lightGreen = '#a5ff90', // Regular strings, markup inserted
|
|
141
|
+
red = '#f44542', // Invalid, errors
|
|
142
|
+
errorRed = '#A22929', // Error foreground
|
|
143
|
+
// Additional colors from the original palette
|
|
144
|
+
gray = '#aaa', // Comments, secondary text
|
|
145
|
+
lightGray = '#e1efff', // Punctuation, variables
|
|
146
|
+
darkGray = '#0d3a58', // Borders, inactive elements
|
|
147
|
+
parameterYellow = '#ffee80', // Parameters, template expressions
|
|
148
|
+
stringQuotes = '#92fc79', // String quotes (special)
|
|
149
|
+
supportTeal = '#80ffbb'; // Support classes, TypeScript types
|
|
150
|
+
// Diff/merge specific colors (exact from original)
|
|
151
|
+
const addedBackground = '#3ad90033', // Light green with transparency for insertions
|
|
152
|
+
removedBackground = '#ee3a4333', // Light red with transparency for deletions
|
|
153
|
+
addedText = lightGreen, // Green for added text
|
|
154
|
+
removedText = pink; // Pink for removed text
|
|
155
|
+
/**
|
|
156
|
+
* Enhanced editor theme styles for Cobalt2
|
|
157
|
+
*/
|
|
158
|
+
const cobalt2Theme = view.EditorView.theme({
|
|
159
|
+
// Base editor styles
|
|
160
|
+
'&': {
|
|
161
|
+
color: foreground,
|
|
162
|
+
backgroundColor: background,
|
|
163
|
+
fontSize: generalContent.fontSize,
|
|
164
|
+
fontFamily: generalContent.fontFamily,
|
|
165
|
+
},
|
|
166
|
+
// Content and cursor
|
|
167
|
+
'.cm-content': {
|
|
168
|
+
caretColor: cursor,
|
|
169
|
+
lineHeight: generalContent.lineHeight,
|
|
170
|
+
},
|
|
171
|
+
'.cm-cursor, .cm-dropCursor': {
|
|
172
|
+
borderLeftColor: cursor,
|
|
173
|
+
borderLeftWidth: generalCursor.borderLeftWidth,
|
|
174
|
+
},
|
|
175
|
+
'.cm-fat-cursor': {
|
|
176
|
+
backgroundColor: `${cursor}99`,
|
|
177
|
+
color: background,
|
|
178
|
+
},
|
|
179
|
+
// Selection
|
|
180
|
+
'&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': {
|
|
181
|
+
backgroundColor: selection,
|
|
182
|
+
color: foreground,
|
|
183
|
+
},
|
|
184
|
+
// Make sure selection appears above active line
|
|
185
|
+
'.cm-selectionLayer': {
|
|
186
|
+
zIndex: 100,
|
|
187
|
+
},
|
|
188
|
+
'.cm-activeLine .cm-selectionBackground': {
|
|
189
|
+
backgroundColor: `${selection}DD`,
|
|
190
|
+
border: `1px solid ${cyan}40`,
|
|
191
|
+
borderRadius: '2px',
|
|
192
|
+
},
|
|
193
|
+
'&.cm-focused .cm-activeLine .cm-selectionBackground': {
|
|
194
|
+
backgroundColor: `${selection}FF`,
|
|
195
|
+
border: `1px solid ${cyan}60`,
|
|
196
|
+
boxShadow: `0 0 3px ${cyan}30`,
|
|
197
|
+
},
|
|
198
|
+
'&:not(.cm-focused) .cm-selectionBackground': {
|
|
199
|
+
backgroundColor: selectionInactive,
|
|
200
|
+
},
|
|
201
|
+
'&:not(.cm-focused) .cm-activeLine .cm-selectionBackground': {
|
|
202
|
+
backgroundColor: `${selectionInactive}CC`,
|
|
203
|
+
border: `1px solid ${darkGray}80`,
|
|
204
|
+
},
|
|
205
|
+
// Search functionality
|
|
206
|
+
'.cm-searchMatch': {
|
|
207
|
+
backgroundColor: findMatchCurrent,
|
|
208
|
+
outline: `1px solid ${orange}`,
|
|
209
|
+
color: foreground,
|
|
210
|
+
borderRadius: generalSearchField.borderRadius,
|
|
211
|
+
},
|
|
212
|
+
'.cm-searchMatch.cm-searchMatch-selected': {
|
|
213
|
+
backgroundColor: findMatchOther,
|
|
214
|
+
color: foreground,
|
|
215
|
+
},
|
|
216
|
+
'.cm-search.cm-panel.cm-textfield': {
|
|
217
|
+
color: yellow,
|
|
218
|
+
backgroundColor: background,
|
|
219
|
+
border: `1px solid ${darkGray}`,
|
|
220
|
+
borderRadius: generalSearchField.borderRadius,
|
|
221
|
+
padding: generalSearchField.padding,
|
|
222
|
+
},
|
|
223
|
+
// Panels
|
|
224
|
+
'.cm-panels': {
|
|
225
|
+
backgroundColor: darkBackground,
|
|
226
|
+
color: gray,
|
|
227
|
+
borderRadius: '4px',
|
|
228
|
+
},
|
|
229
|
+
'.cm-panels.cm-panels-top': {
|
|
230
|
+
borderBottom: `1px solid ${yellow}`,
|
|
231
|
+
},
|
|
232
|
+
'.cm-panels.cm-panels-bottom': {
|
|
233
|
+
borderTop: `1px solid ${yellow}`,
|
|
234
|
+
},
|
|
235
|
+
'.cm-panel button': {
|
|
236
|
+
backgroundColor: blue,
|
|
237
|
+
color: foreground,
|
|
238
|
+
border: `1px solid ${darkGray}`,
|
|
239
|
+
borderRadius: generalPanel.borderRadius,
|
|
240
|
+
padding: generalPanel.padding,
|
|
241
|
+
},
|
|
242
|
+
'.cm-panel button:hover': {
|
|
243
|
+
backgroundColor: orange,
|
|
244
|
+
color: foreground,
|
|
245
|
+
},
|
|
246
|
+
// Line highlighting
|
|
247
|
+
'.cm-activeLine': {
|
|
248
|
+
backgroundColor: lineHighlight,
|
|
249
|
+
borderRadius: generalLine.borderRadius,
|
|
250
|
+
},
|
|
251
|
+
// Gutters
|
|
252
|
+
'.cm-gutters': {
|
|
253
|
+
backgroundColor: gutterBackground,
|
|
254
|
+
color: gray,
|
|
255
|
+
border: generalGutter.border,
|
|
256
|
+
borderRight: `1px solid ${darkGray}`,
|
|
257
|
+
paddingRight: generalGutter.paddingRight,
|
|
258
|
+
},
|
|
259
|
+
'.cm-activeLineGutter': {
|
|
260
|
+
backgroundColor: 'transparent',
|
|
261
|
+
color: foreground,
|
|
262
|
+
fontWeight: generalGutter.fontWeight,
|
|
263
|
+
},
|
|
264
|
+
'.cm-lineNumbers': {
|
|
265
|
+
fontSize: generalGutter.fontSize,
|
|
266
|
+
color: gray,
|
|
267
|
+
},
|
|
268
|
+
'.cm-foldGutter': {
|
|
269
|
+
fontSize: generalGutter.fontSize,
|
|
270
|
+
},
|
|
271
|
+
'.cm-foldGutter .cm-gutterElement': {
|
|
272
|
+
color: gray,
|
|
273
|
+
cursor: 'pointer',
|
|
274
|
+
},
|
|
275
|
+
'.cm-foldGutter .cm-gutterElement:hover': {
|
|
276
|
+
color: yellow,
|
|
277
|
+
},
|
|
278
|
+
// Diff/Merge View Styles
|
|
279
|
+
// Inserted/Added Content
|
|
280
|
+
'.cm-insertedLine': {
|
|
281
|
+
textDecoration: generalDiff.insertedTextDecoration,
|
|
282
|
+
backgroundColor: addedBackground,
|
|
283
|
+
color: addedText,
|
|
284
|
+
padding: generalDiff.insertedLinePadding,
|
|
285
|
+
borderRadius: generalDiff.borderRadious,
|
|
286
|
+
},
|
|
287
|
+
'ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))': {
|
|
288
|
+
textDecoration: generalDiff.insertedTextDecoration,
|
|
289
|
+
backgroundColor: `${addedBackground} !important`,
|
|
290
|
+
color: addedText,
|
|
291
|
+
padding: generalDiff.insertedLinePadding,
|
|
292
|
+
borderRadius: generalDiff.borderRadious,
|
|
293
|
+
border: `1px solid ${addedText}30`,
|
|
294
|
+
},
|
|
295
|
+
'ins.cm-insertedLine .cm-changedText': {
|
|
296
|
+
background: 'transparent !important',
|
|
297
|
+
},
|
|
298
|
+
// Deleted/Removed Content
|
|
299
|
+
'.cm-deletedLine': {
|
|
300
|
+
textDecoration: generalDiff.deletedTextDecoration,
|
|
301
|
+
backgroundColor: removedBackground,
|
|
302
|
+
color: removedText,
|
|
303
|
+
padding: generalDiff.insertedLinePadding,
|
|
304
|
+
borderRadius: generalDiff.borderRadious,
|
|
305
|
+
},
|
|
306
|
+
'del.cm-deletedLine, del, del:not(:has(.cm-deletedText))': {
|
|
307
|
+
textDecoration: generalDiff.deletedTextDecoration,
|
|
308
|
+
backgroundColor: `${removedBackground} !important`,
|
|
309
|
+
color: removedText,
|
|
310
|
+
padding: generalDiff.insertedLinePadding,
|
|
311
|
+
borderRadius: generalDiff.borderRadious,
|
|
312
|
+
border: `1px solid ${removedText}30`,
|
|
313
|
+
},
|
|
314
|
+
'del .cm-deletedText, del .cm-changedText': {
|
|
315
|
+
background: 'transparent !important',
|
|
316
|
+
},
|
|
317
|
+
// Tooltips and autocomplete
|
|
318
|
+
'.cm-tooltip': {
|
|
319
|
+
backgroundColor: panelBackground,
|
|
320
|
+
border: `1px solid ${darkGray}`,
|
|
321
|
+
borderRadius: generalTooltip.borderRadius,
|
|
322
|
+
padding: generalTooltip.padding,
|
|
323
|
+
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.3)',
|
|
324
|
+
color: gray, // Tooltip text color from the original
|
|
325
|
+
},
|
|
326
|
+
'.cm-tooltip-autocomplete': {
|
|
327
|
+
'& > ul': {
|
|
328
|
+
backgroundColor: panelBackground,
|
|
329
|
+
border: 'none',
|
|
330
|
+
},
|
|
331
|
+
'& > ul > li': {
|
|
332
|
+
padding: generalTooltip.padding,
|
|
333
|
+
lineHeight: generalTooltip.lineHeight,
|
|
334
|
+
color: gray,
|
|
335
|
+
},
|
|
336
|
+
'& > ul > li[aria-selected]': {
|
|
337
|
+
backgroundColor: background,
|
|
338
|
+
color: yellow,
|
|
339
|
+
borderRadius: generalTooltip.borderRadiusSelected,
|
|
340
|
+
},
|
|
341
|
+
'& > ul > li > span.cm-completionIcon': {
|
|
342
|
+
color: blue,
|
|
343
|
+
paddingRight: generalTooltip.paddingRight,
|
|
344
|
+
},
|
|
345
|
+
'& > ul > li > span.cm-completionDetail': {
|
|
346
|
+
color: gray,
|
|
347
|
+
fontStyle: 'italic',
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
// Diagnostics styling
|
|
351
|
+
'.cm-diagnostic': {
|
|
352
|
+
'&-error': {
|
|
353
|
+
borderLeft: `3px solid ${errorRed}`,
|
|
354
|
+
},
|
|
355
|
+
'&-warning': {
|
|
356
|
+
borderLeft: `3px solid ${yellow}`,
|
|
357
|
+
},
|
|
358
|
+
'&-info': {
|
|
359
|
+
borderLeft: `3px solid ${blue}`,
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
'.cm-lintPoint-error': {
|
|
363
|
+
borderBottom: `2px wavy ${errorRed}`,
|
|
364
|
+
},
|
|
365
|
+
'.cm-lintPoint-warning': {
|
|
366
|
+
borderBottom: `2px wavy ${yellow}`,
|
|
367
|
+
},
|
|
368
|
+
// Matching brackets
|
|
369
|
+
'.cm-matchingBracket': {
|
|
370
|
+
backgroundColor: darkGray,
|
|
371
|
+
outline: `1px solid ${cursor}80`,
|
|
372
|
+
borderRadius: generalMatching.borderRadius,
|
|
373
|
+
},
|
|
374
|
+
'.cm-nonmatchingBracket': {
|
|
375
|
+
backgroundColor: `${errorRed}20`,
|
|
376
|
+
outline: `1px solid ${errorRed}`,
|
|
377
|
+
borderRadius: generalMatching.borderRadius,
|
|
378
|
+
},
|
|
379
|
+
// Selection matches
|
|
380
|
+
'.cm-selectionMatch': {
|
|
381
|
+
backgroundColor: selectionHighlight,
|
|
382
|
+
borderRadius: generalMatching.borderRadius,
|
|
383
|
+
},
|
|
384
|
+
'.cm-hoverHighlight': {
|
|
385
|
+
backgroundColor: hoverHighlight,
|
|
386
|
+
},
|
|
387
|
+
'.cm-wordHighlight': {
|
|
388
|
+
backgroundColor: wordHighlight,
|
|
389
|
+
borderRadius: generalMatching.borderRadius,
|
|
390
|
+
},
|
|
391
|
+
// Fold placeholder
|
|
392
|
+
'.cm-foldPlaceholder': {
|
|
393
|
+
backgroundColor: 'transparent',
|
|
394
|
+
color: gray,
|
|
395
|
+
border: `1px dotted ${blue}50`,
|
|
396
|
+
borderRadius: generalPlaceholder.borderRadius,
|
|
397
|
+
padding: generalPlaceholder.padding,
|
|
398
|
+
margin: generalPlaceholder.margin,
|
|
399
|
+
},
|
|
400
|
+
// Focus outline
|
|
401
|
+
'&.cm-focused': {
|
|
402
|
+
outline: 'none',
|
|
403
|
+
},
|
|
404
|
+
// Scrollbars - exact from original
|
|
405
|
+
'& .cm-scroller::-webkit-scrollbar': {
|
|
406
|
+
width: generalScroller.width,
|
|
407
|
+
height: generalScroller.height,
|
|
408
|
+
},
|
|
409
|
+
'& .cm-scroller::-webkit-scrollbar-track': {
|
|
410
|
+
background: darkBackground,
|
|
411
|
+
},
|
|
412
|
+
'& .cm-scroller::-webkit-scrollbar-thumb': {
|
|
413
|
+
backgroundColor: '#406179cc',
|
|
414
|
+
borderRadius: generalScroller.borderRadius,
|
|
415
|
+
border: `3px solid ${darkBackground}`,
|
|
416
|
+
},
|
|
417
|
+
'& .cm-scroller::-webkit-scrollbar-thumb:hover': {
|
|
418
|
+
backgroundColor: '#437da3cc',
|
|
419
|
+
},
|
|
420
|
+
// Ghost text
|
|
421
|
+
'.cm-ghostText': {
|
|
422
|
+
opacity: '0.5',
|
|
423
|
+
color: gray,
|
|
424
|
+
},
|
|
425
|
+
// Whitespace characters
|
|
426
|
+
'.cm-specialChar': {
|
|
427
|
+
color: '#ffffff52',
|
|
428
|
+
},
|
|
429
|
+
// Indent guides
|
|
430
|
+
'.cm-indentGuide': {
|
|
431
|
+
borderLeft: '1px solid #3B5364',
|
|
432
|
+
},
|
|
433
|
+
}, { dark: true });
|
|
434
|
+
/**
|
|
435
|
+
* Enhanced syntax highlighting for the Cobalt2 theme
|
|
436
|
+
*/
|
|
437
|
+
const cobalt2HighlightStyle = language.HighlightStyle.define([
|
|
438
|
+
// Keywords and control flow
|
|
439
|
+
{ tag: highlight.tags.keyword, color: orange },
|
|
440
|
+
{ tag: highlight.tags.controlKeyword, color: orange },
|
|
441
|
+
{ tag: highlight.tags.operatorKeyword, color: orange },
|
|
442
|
+
{ tag: highlight.tags.moduleKeyword, color: cyan },
|
|
443
|
+
{ tag: highlight.tags.definitionKeyword, color: hotPink },
|
|
444
|
+
// Variables - Enhanced for better distinction
|
|
445
|
+
{ tag: highlight.tags.variableName, color: foreground },
|
|
446
|
+
{ tag: highlight.tags.definition(highlight.tags.variableName), color: foreground },
|
|
447
|
+
{ tag: highlight.tags.local(highlight.tags.variableName), color: foreground },
|
|
448
|
+
// Classes and types
|
|
449
|
+
{ tag: highlight.tags.typeName, color: lightPink, fontStyle: 'italic' },
|
|
450
|
+
{ tag: highlight.tags.className, color: lightPink, fontStyle: 'italic' },
|
|
451
|
+
{ tag: highlight.tags.namespace, color: lightPink, fontStyle: 'italic' },
|
|
452
|
+
{ tag: highlight.tags.macroName, color: lightPink, fontStyle: 'italic' },
|
|
453
|
+
{ tag: highlight.tags.standard(highlight.tags.tagName), color: supportTeal },
|
|
454
|
+
{ tag: highlight.tags.standard(highlight.tags.propertyName), color: supportTeal },
|
|
455
|
+
// Operators and punctuation
|
|
456
|
+
{ tag: highlight.tags.operator, color: lightGray },
|
|
457
|
+
{ tag: highlight.tags.derefOperator, color: lightGray },
|
|
458
|
+
{ tag: highlight.tags.arithmeticOperator, color: lightGray },
|
|
459
|
+
{ tag: highlight.tags.logicOperator, color: lightGray },
|
|
460
|
+
{ tag: highlight.tags.bitwiseOperator, color: lightGray },
|
|
461
|
+
{ tag: highlight.tags.compareOperator, color: lightGray },
|
|
462
|
+
{ tag: highlight.tags.updateOperator, color: lightGray },
|
|
463
|
+
{ tag: highlight.tags.punctuation, color: lightGray },
|
|
464
|
+
{ tag: highlight.tags.bracket, color: lightGray },
|
|
465
|
+
{ tag: highlight.tags.brace, color: lightGray },
|
|
466
|
+
{ tag: highlight.tags.squareBracket, color: lightGray },
|
|
467
|
+
{ tag: highlight.tags.paren, color: yellow },
|
|
468
|
+
{ tag: highlight.tags.angleBracket, color: lightGray },
|
|
469
|
+
{ tag: [highlight.tags.operator, highlight.tags.punctuation], color: lightGray },
|
|
470
|
+
// Functions
|
|
471
|
+
{ tag: highlight.tags.function(highlight.tags.variableName), color: yellow },
|
|
472
|
+
{ tag: highlight.tags.function(highlight.tags.definition(highlight.tags.variableName)), color: yellow },
|
|
473
|
+
{ tag: highlight.tags.function(highlight.tags.propertyName), color: yellow },
|
|
474
|
+
{ tag: [highlight.tags.moduleKeyword, highlight.tags.special(highlight.tags.keyword)], color: cyan },
|
|
475
|
+
{ tag: [highlight.tags.definitionKeyword], color: hotPink },
|
|
476
|
+
// Comments
|
|
477
|
+
{ tag: highlight.tags.comment, color: blue, fontStyle: 'italic' },
|
|
478
|
+
{ tag: highlight.tags.docComment, color: blue, fontStyle: 'italic' },
|
|
479
|
+
{ tag: highlight.tags.lineComment, color: blue, fontStyle: 'italic' },
|
|
480
|
+
{ tag: highlight.tags.blockComment, color: blue, fontStyle: 'italic' },
|
|
481
|
+
// Storage and function keywords
|
|
482
|
+
{ tag: highlight.tags.modifier, color: yellow, fontStyle: 'italic' },
|
|
483
|
+
// Special variables and exports
|
|
484
|
+
{ tag: highlight.tags.special(highlight.tags.variableName), color: cyan },
|
|
485
|
+
// Properties
|
|
486
|
+
{ tag: highlight.tags.propertyName, color: lightBlue },
|
|
487
|
+
{ tag: highlight.tags.definition(highlight.tags.propertyName), color: lightBlue },
|
|
488
|
+
// Constants
|
|
489
|
+
{ tag: highlight.tags.constant(highlight.tags.name), color: pink },
|
|
490
|
+
{ tag: highlight.tags.standard(highlight.tags.name), color: pink },
|
|
491
|
+
{ tag: highlight.tags.number, color: pink },
|
|
492
|
+
{ tag: highlight.tags.integer, color: pink },
|
|
493
|
+
{ tag: highlight.tags.float, color: pink },
|
|
494
|
+
{ tag: highlight.tags.bool, color: pink },
|
|
495
|
+
{ tag: highlight.tags.atom, color: pink },
|
|
496
|
+
{ tag: highlight.tags.null, color: pink },
|
|
497
|
+
// Strings
|
|
498
|
+
{ tag: highlight.tags.string, color: lightGreen },
|
|
499
|
+
{ tag: highlight.tags.special(highlight.tags.string), color: green },
|
|
500
|
+
{ tag: highlight.tags.regexp, color: lightGreen },
|
|
501
|
+
// String quotes
|
|
502
|
+
{ tag: highlight.tags.quote, color: stringQuotes },
|
|
503
|
+
// Parameters
|
|
504
|
+
{ tag: highlight.tags.definition(highlight.tags.function(highlight.tags.variableName)), color: parameterYellow },
|
|
505
|
+
// HTML/XML elements
|
|
506
|
+
{ tag: highlight.tags.tagName, color: lightBlue },
|
|
507
|
+
{ tag: highlight.tags.attributeName, color: yellow, fontStyle: 'italic' },
|
|
508
|
+
{ tag: highlight.tags.attributeValue, color: lightGreen },
|
|
509
|
+
// Special language constructs
|
|
510
|
+
{ tag: highlight.tags.self, color: hotPink },
|
|
511
|
+
// Meta and annotations
|
|
512
|
+
{ tag: highlight.tags.meta, color: lightBlue },
|
|
513
|
+
{ tag: highlight.tags.annotation, color: yellow, fontStyle: 'italic' },
|
|
514
|
+
{ tag: highlight.tags.processingInstruction, color: yellow },
|
|
515
|
+
{ tag: highlight.tags.heading, color: yellow, fontWeight: 'bold' },
|
|
516
|
+
{ tag: highlight.tags.heading1, color: yellow, fontWeight: 'bold' },
|
|
517
|
+
{ tag: highlight.tags.heading2, color: yellow, fontWeight: 'bold' },
|
|
518
|
+
{ tag: highlight.tags.heading3, color: yellow, fontWeight: 'bold' },
|
|
519
|
+
{ tag: highlight.tags.heading4, color: yellow, fontWeight: 'bold' },
|
|
520
|
+
{ tag: highlight.tags.heading5, color: yellow, fontWeight: 'bold' },
|
|
521
|
+
{ tag: highlight.tags.heading6, color: yellow, fontWeight: 'bold' },
|
|
522
|
+
{ tag: highlight.tags.contentSeparator, color: yellow },
|
|
523
|
+
{ tag: highlight.tags.strong, color: lightBlue, fontWeight: 'bold' },
|
|
524
|
+
{ tag: highlight.tags.emphasis, color: lightBlue, fontStyle: 'italic' },
|
|
525
|
+
{ tag: highlight.tags.list, color: yellow },
|
|
526
|
+
{ tag: highlight.tags.quote, color: lightBlue, fontStyle: 'italic' },
|
|
527
|
+
// Code blocks and inline code - Enhanced styling
|
|
528
|
+
{ tag: highlight.tags.monospace, color: lightBlue },
|
|
529
|
+
{ tag: highlight.tags.special(highlight.tags.monospace), color: green },
|
|
530
|
+
{ tag: highlight.tags.strikethrough, color: gray, textDecoration: 'line-through' },
|
|
531
|
+
// Links and URLs
|
|
532
|
+
{ tag: highlight.tags.link, color: blue },
|
|
533
|
+
{ tag: highlight.tags.url, color: lightBlue },
|
|
534
|
+
// Special states
|
|
535
|
+
{ tag: highlight.tags.invalid, color: red },
|
|
536
|
+
{ tag: highlight.tags.deleted, color: pink },
|
|
537
|
+
{ tag: highlight.tags.inserted, color: lightGreen },
|
|
538
|
+
{ tag: highlight.tags.changed, color: yellow },
|
|
539
|
+
// Module system - exports, require, module should be cyan
|
|
540
|
+
{ tag: highlight.tags.special(highlight.tags.keyword), color: cyan }, // Special keywords like exports
|
|
541
|
+
// Function declarations and expressions - function keyword should be magenta
|
|
542
|
+
{ tag: highlight.tags.definitionKeyword, color: hotPink }, // function, class, etc.
|
|
543
|
+
// Method names and function assignments - yellow
|
|
544
|
+
{ tag: highlight.tags.function(highlight.tags.propertyName), color: yellow }, // obj.method, exports.functionName
|
|
545
|
+
// Arrow functions and anonymous functions
|
|
546
|
+
{ tag: highlight.tags.function(highlight.tags.definition(highlight.tags.variableName)), color: yellow },
|
|
547
|
+
// Object property access - cyan for special objects like exports
|
|
548
|
+
{ tag: highlight.tags.special(highlight.tags.propertyName), color: cyan }, // exports.something
|
|
549
|
+
// Language-specific: CSS
|
|
550
|
+
{ tag: highlight.tags.unit, color: parameterYellow }, // CSS units
|
|
551
|
+
// Enhanced code block syntax highlighting for better JavaScript support
|
|
552
|
+
// ====================================================================
|
|
553
|
+
// JavaScript/TypeScript keywords in code blocks
|
|
554
|
+
{ tag: [highlight.tags.controlKeyword, highlight.tags.keyword], color: orange }, // return, if, else, etc.
|
|
555
|
+
// Variables in code blocks - white for better readability
|
|
556
|
+
{ tag: [highlight.tags.variableName, highlight.tags.local(highlight.tags.variableName)], color: foreground },
|
|
557
|
+
// Functions in code blocks - yellow
|
|
558
|
+
{
|
|
559
|
+
tag: [highlight.tags.function(highlight.tags.variableName), highlight.tags.function(highlight.tags.definition(highlight.tags.variableName))],
|
|
560
|
+
color: yellow,
|
|
561
|
+
},
|
|
562
|
+
// Strings in code blocks
|
|
563
|
+
{ tag: [highlight.tags.string, highlight.tags.special(highlight.tags.string)], color: lightGreen },
|
|
564
|
+
// Numbers in code blocks
|
|
565
|
+
{ tag: [highlight.tags.number, highlight.tags.integer, highlight.tags.float], color: pink },
|
|
566
|
+
// Comments in code blocks
|
|
567
|
+
{
|
|
568
|
+
tag: [highlight.tags.comment, highlight.tags.lineComment, highlight.tags.blockComment],
|
|
569
|
+
color: blue,
|
|
570
|
+
fontStyle: 'italic',
|
|
571
|
+
},
|
|
572
|
+
// HTML/XML in code blocks
|
|
573
|
+
{ tag: [highlight.tags.tagName, highlight.tags.angleBracket], color: lightBlue },
|
|
574
|
+
{ tag: [highlight.tags.attributeName], color: yellow, fontStyle: 'italic' },
|
|
575
|
+
{ tag: [highlight.tags.attributeValue], color: lightGreen },
|
|
576
|
+
{ tag: [highlight.tags.propertyName], color: lightBlue },
|
|
577
|
+
{ tag: [highlight.tags.className], color: lightPink, fontStyle: 'italic' },
|
|
578
|
+
{ tag: [highlight.tags.standard(highlight.tags.propertyName)], color: supportTeal },
|
|
579
|
+
// Entity names
|
|
580
|
+
{ tag: highlight.tags.labelName, color: yellow },
|
|
581
|
+
{ tag: highlight.tags.escape, color: yellow },
|
|
582
|
+
]);
|
|
583
|
+
/**
|
|
584
|
+
* Combined Cobalt2 theme extension
|
|
585
|
+
*/
|
|
586
|
+
const cobalt2 = [
|
|
587
|
+
cobalt2Theme,
|
|
588
|
+
language.syntaxHighlighting(cobalt2HighlightStyle),
|
|
589
|
+
];
|
|
590
|
+
/**
|
|
591
|
+
* Cobalt2 merge revert styles configuration
|
|
592
|
+
*/
|
|
593
|
+
const cobalt2MergeStyles = {
|
|
594
|
+
backgroundColor: panelBackground,
|
|
595
|
+
borderColor: darkGray,
|
|
596
|
+
buttonColor: gray,
|
|
597
|
+
buttonHoverColor: darkGray,
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
exports.applyMergeRevertStyles = applyMergeRevertStyles;
|
|
601
|
+
exports.cobalt2 = cobalt2;
|
|
602
|
+
exports.cobalt2MergeStyles = cobalt2MergeStyles;
|
package/dist/index.d.cts
ADDED
|
@@ -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 Cobalt2 theme extension
|
|
21
|
+
*/
|
|
22
|
+
declare const cobalt2: Extension;
|
|
23
|
+
/**
|
|
24
|
+
* Cobalt2 merge revert styles configuration
|
|
25
|
+
*/
|
|
26
|
+
declare const cobalt2MergeStyles: IMergeRevertStyles;
|
|
27
|
+
|
|
28
|
+
export { applyMergeRevertStyles, cobalt2, cobalt2MergeStyles };
|
package/dist/index.d.ts
ADDED
|
@@ -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 Cobalt2 theme extension
|
|
21
|
+
*/
|
|
22
|
+
declare const cobalt2: Extension;
|
|
23
|
+
/**
|
|
24
|
+
* Cobalt2 merge revert styles configuration
|
|
25
|
+
*/
|
|
26
|
+
declare const cobalt2MergeStyles: IMergeRevertStyles;
|
|
27
|
+
|
|
28
|
+
export { applyMergeRevertStyles, cobalt2, cobalt2MergeStyles };
|