@fsegurai/codemirror-theme-catppuccin-mocha 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 +121 -0
- package/dist/index.cjs +489 -0
- package/dist/index.d.cts +28 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +485 -0
- package/package.json +56 -0
- package/src/index.ts +472 -0
- package/src/utils.ts +126 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
import { EditorView } from '@codemirror/view';
|
|
2
|
+
import { Extension } from '@codemirror/state';
|
|
3
|
+
import { HighlightStyle, syntaxHighlighting } from '@codemirror/language';
|
|
4
|
+
import { tags as t } from '@lezer/highlight';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
applyMergeRevertStyles,
|
|
8
|
+
generalContent,
|
|
9
|
+
generalCursor,
|
|
10
|
+
generalDiff,
|
|
11
|
+
generalGutter,
|
|
12
|
+
generalLine,
|
|
13
|
+
generalMatching,
|
|
14
|
+
generalPanel,
|
|
15
|
+
generalPlaceholder,
|
|
16
|
+
generalScroller,
|
|
17
|
+
generalSearchField,
|
|
18
|
+
generalTooltip,
|
|
19
|
+
IMergeRevertStyles,
|
|
20
|
+
} from './utils';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Catppuccin Mocha theme color definitions
|
|
24
|
+
* ----------------------------------------
|
|
25
|
+
* A soothing pastel theme with warm tones
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
// Base colors (Mocha variant)
|
|
29
|
+
const base00 = '#1e1e2e', // Background - dark navy
|
|
30
|
+
base01 = '#313244', // Selection background
|
|
31
|
+
base02 = '#45475a', // Comments
|
|
32
|
+
base03 = '#585b70', // Dark grey
|
|
33
|
+
base04 = '#cdd6f4', // Foreground - light blue
|
|
34
|
+
base05 = '#f5e0dc', // Light foreground
|
|
35
|
+
|
|
36
|
+
// Catppuccin Mocha colors
|
|
37
|
+
rosewater = '#f5e0dc',
|
|
38
|
+
flamingo = '#f2cdcd',
|
|
39
|
+
pink = '#f5c2e7',
|
|
40
|
+
mauve = '#cba6f7',
|
|
41
|
+
red = '#f38ba8',
|
|
42
|
+
maroon = '#eba0ac',
|
|
43
|
+
peach = '#fab387',
|
|
44
|
+
yellow = '#f9e2af',
|
|
45
|
+
green = '#a6e3a1',
|
|
46
|
+
teal = '#94e2d5',
|
|
47
|
+
sky = '#89dceb',
|
|
48
|
+
sapphire = '#74c7ec',
|
|
49
|
+
blue = '#89b4fa',
|
|
50
|
+
lavender = '#b4befe';
|
|
51
|
+
|
|
52
|
+
// UI specific colors
|
|
53
|
+
const invalid = '#f38ba8',
|
|
54
|
+
darkBackground = '#181825',
|
|
55
|
+
background = base00,
|
|
56
|
+
tooltipBackground = base01,
|
|
57
|
+
selectionMatch = '#45475a80',
|
|
58
|
+
cursor = rosewater,
|
|
59
|
+
activeBracketBg = '#45475a55',
|
|
60
|
+
activeBracketBorder = lavender,
|
|
61
|
+
diagnosticWarning = yellow,
|
|
62
|
+
linkColor = blue,
|
|
63
|
+
visitedLinkColor = mauve;
|
|
64
|
+
|
|
65
|
+
// Diff/merge specific colors
|
|
66
|
+
const addedBackground = '#a6e3a140',
|
|
67
|
+
removedBackground = '#f38ba840',
|
|
68
|
+
addedText = green,
|
|
69
|
+
removedText = red;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Enhanced editor theme styles for Catppuccin Mocha
|
|
73
|
+
*/
|
|
74
|
+
const catppuccinMochaTheme = EditorView.theme(
|
|
75
|
+
{
|
|
76
|
+
// Base editor styles
|
|
77
|
+
'&': {
|
|
78
|
+
color: base04,
|
|
79
|
+
backgroundColor: background,
|
|
80
|
+
fontSize: generalContent.fontSize,
|
|
81
|
+
fontFamily: generalContent.fontFamily,
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
// Content and cursor
|
|
85
|
+
'.cm-content': {
|
|
86
|
+
caretColor: cursor,
|
|
87
|
+
lineHeight: generalContent.lineHeight,
|
|
88
|
+
},
|
|
89
|
+
'.cm-cursor, .cm-dropCursor': {
|
|
90
|
+
borderLeftColor: cursor,
|
|
91
|
+
borderLeftWidth: generalCursor.borderLeftWidth,
|
|
92
|
+
},
|
|
93
|
+
'.cm-fat-cursor': {
|
|
94
|
+
backgroundColor: `${cursor}99`,
|
|
95
|
+
color: background,
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
// Selection
|
|
99
|
+
'&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection':
|
|
100
|
+
{
|
|
101
|
+
backgroundColor: '#585b7080',
|
|
102
|
+
outline: `1px solid ${mauve}`,
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
// Make sure selection appears above active line
|
|
106
|
+
'.cm-selectionLayer': {
|
|
107
|
+
zIndex: 100,
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
// Search functionality
|
|
111
|
+
'.cm-searchMatch': {
|
|
112
|
+
backgroundColor: '#89b4fa40',
|
|
113
|
+
outline: `1px solid ${sapphire}`,
|
|
114
|
+
color: base04,
|
|
115
|
+
borderRadius: generalSearchField.borderRadius,
|
|
116
|
+
|
|
117
|
+
'& span': {
|
|
118
|
+
color: base04,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
'.cm-searchMatch.cm-searchMatch-selected': {
|
|
122
|
+
backgroundColor: blue,
|
|
123
|
+
color: base00,
|
|
124
|
+
padding: generalSearchField.padding,
|
|
125
|
+
|
|
126
|
+
'& span': {
|
|
127
|
+
color: base00,
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
'.cm-search.cm-panel.cm-textfield': {
|
|
131
|
+
color: base04,
|
|
132
|
+
borderRadius: generalSearchField.borderRadius,
|
|
133
|
+
padding: generalSearchField.padding,
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
// Panels
|
|
137
|
+
'.cm-panels': {
|
|
138
|
+
backgroundColor: darkBackground,
|
|
139
|
+
color: base04,
|
|
140
|
+
borderRadius: '4px',
|
|
141
|
+
},
|
|
142
|
+
'.cm-panels.cm-panels-top': {
|
|
143
|
+
borderBottom: `1px solid ${base02}`,
|
|
144
|
+
},
|
|
145
|
+
'.cm-panels.cm-panels-bottom': {
|
|
146
|
+
borderTop: `1px solid ${base02}`,
|
|
147
|
+
},
|
|
148
|
+
'.cm-panel button': {
|
|
149
|
+
backgroundColor: tooltipBackground,
|
|
150
|
+
color: base04,
|
|
151
|
+
border: generalPanel.border,
|
|
152
|
+
borderRadius: generalPanel.borderRadius,
|
|
153
|
+
padding: generalPanel.padding,
|
|
154
|
+
},
|
|
155
|
+
'.cm-panel button:hover': {
|
|
156
|
+
backgroundColor: base01,
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
// Line highlighting
|
|
160
|
+
'.cm-activeLine': {
|
|
161
|
+
backgroundColor: '#3a3a5266',
|
|
162
|
+
borderRadius: generalLine.borderRadius,
|
|
163
|
+
borderLeft: `2px solid ${lavender}`,
|
|
164
|
+
zIndex: 1,
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
// Gutters
|
|
168
|
+
'.cm-gutters': {
|
|
169
|
+
backgroundColor: darkBackground,
|
|
170
|
+
color: base02,
|
|
171
|
+
border: generalGutter.border,
|
|
172
|
+
borderRight: `1px solid ${base01}`,
|
|
173
|
+
paddingRight: generalGutter.paddingRight,
|
|
174
|
+
},
|
|
175
|
+
'.cm-activeLineGutter': {
|
|
176
|
+
backgroundColor: base01,
|
|
177
|
+
color: base04,
|
|
178
|
+
fontWeight: generalGutter.fontWeight,
|
|
179
|
+
},
|
|
180
|
+
'.cm-lineNumbers': {
|
|
181
|
+
fontSize: generalGutter.fontSize,
|
|
182
|
+
lineHeight: generalGutter.lineHeight,
|
|
183
|
+
},
|
|
184
|
+
'.cm-foldGutter': {
|
|
185
|
+
fontSize: generalGutter.fontSize,
|
|
186
|
+
lineHeight: generalGutter.lineHeight,
|
|
187
|
+
},
|
|
188
|
+
'.cm-foldGutter .cm-gutterElement': {
|
|
189
|
+
color: base02,
|
|
190
|
+
cursor: 'pointer',
|
|
191
|
+
},
|
|
192
|
+
'.cm-foldGutter .cm-gutterElement:hover': {
|
|
193
|
+
color: base04,
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
// Diff/Merge View Styles
|
|
197
|
+
'.cm-insertedLine': {
|
|
198
|
+
textDecoration: generalDiff.insertedTextDecoration,
|
|
199
|
+
backgroundColor: addedBackground,
|
|
200
|
+
color: addedText,
|
|
201
|
+
padding: generalDiff.insertedLinePadding,
|
|
202
|
+
borderRadius: generalDiff.borderRadious,
|
|
203
|
+
},
|
|
204
|
+
'ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))': {
|
|
205
|
+
textDecoration: generalDiff.insertedTextDecoration,
|
|
206
|
+
backgroundColor: `${addedBackground} !important`,
|
|
207
|
+
color: addedText,
|
|
208
|
+
padding: generalDiff.insertedLinePadding,
|
|
209
|
+
borderRadius: generalDiff.borderRadious,
|
|
210
|
+
border: `1px solid ${addedText}40`,
|
|
211
|
+
},
|
|
212
|
+
'ins.cm-insertedLine .cm-changedText': {
|
|
213
|
+
background: 'transparent !important',
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
'.cm-deletedLine': {
|
|
217
|
+
textDecoration: generalDiff.deletedTextDecoration,
|
|
218
|
+
backgroundColor: removedBackground,
|
|
219
|
+
color: removedText,
|
|
220
|
+
padding: generalDiff.insertedLinePadding,
|
|
221
|
+
borderRadius: generalDiff.borderRadious,
|
|
222
|
+
},
|
|
223
|
+
'del.cm-deletedLine, del, del:not(:has(.cm-deletedText))': {
|
|
224
|
+
textDecoration: generalDiff.deletedTextDecoration,
|
|
225
|
+
backgroundColor: `${removedBackground} !important`,
|
|
226
|
+
color: removedText,
|
|
227
|
+
padding: generalDiff.insertedLinePadding,
|
|
228
|
+
borderRadius: generalDiff.borderRadious,
|
|
229
|
+
border: `1px solid ${removedText}40`,
|
|
230
|
+
},
|
|
231
|
+
'del .cm-deletedText, del .cm-changedText': {
|
|
232
|
+
background: 'transparent !important',
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
// Tooltips and autocomplete
|
|
236
|
+
'.cm-tooltip': {
|
|
237
|
+
backgroundColor: tooltipBackground,
|
|
238
|
+
border: `1px solid ${base02}`,
|
|
239
|
+
borderRadius: generalTooltip.borderRadius,
|
|
240
|
+
padding: generalTooltip.padding,
|
|
241
|
+
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.3)',
|
|
242
|
+
},
|
|
243
|
+
'.cm-tooltip-autocomplete': {
|
|
244
|
+
'& > ul': {
|
|
245
|
+
backgroundColor: tooltipBackground,
|
|
246
|
+
border: 'none',
|
|
247
|
+
},
|
|
248
|
+
'& > ul > li': {
|
|
249
|
+
padding: generalTooltip.padding,
|
|
250
|
+
lineHeight: generalTooltip.lineHeight,
|
|
251
|
+
},
|
|
252
|
+
'& > ul > li[aria-selected]': {
|
|
253
|
+
backgroundColor: base01,
|
|
254
|
+
color: base05,
|
|
255
|
+
borderRadius: generalTooltip.borderRadiusSelected,
|
|
256
|
+
},
|
|
257
|
+
'& > ul > li > span.cm-completionIcon': {
|
|
258
|
+
color: base02,
|
|
259
|
+
paddingRight: generalTooltip.paddingRight,
|
|
260
|
+
},
|
|
261
|
+
'& > ul > li > span.cm-completionDetail': {
|
|
262
|
+
color: base02,
|
|
263
|
+
fontStyle: 'italic',
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
'.cm-tooltip .cm-tooltip-arrow:before': {
|
|
267
|
+
borderTopColor: 'transparent',
|
|
268
|
+
borderBottomColor: 'transparent',
|
|
269
|
+
},
|
|
270
|
+
'.cm-tooltip .cm-tooltip-arrow:after': {
|
|
271
|
+
borderTopColor: tooltipBackground,
|
|
272
|
+
borderBottomColor: tooltipBackground,
|
|
273
|
+
},
|
|
274
|
+
|
|
275
|
+
// Diagnostics styling
|
|
276
|
+
'.cm-diagnostic': {
|
|
277
|
+
'&-error': {
|
|
278
|
+
borderLeft: `3px solid ${red}`,
|
|
279
|
+
},
|
|
280
|
+
'&-warning': {
|
|
281
|
+
borderLeft: `3px solid ${diagnosticWarning}`,
|
|
282
|
+
},
|
|
283
|
+
'&-info': {
|
|
284
|
+
borderLeft: `3px solid ${linkColor}`,
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
'.cm-lintPoint-error': {
|
|
288
|
+
borderBottom: `2px wavy ${red}`,
|
|
289
|
+
},
|
|
290
|
+
'.cm-lintPoint-warning': {
|
|
291
|
+
borderBottom: `2px wavy ${diagnosticWarning}`,
|
|
292
|
+
},
|
|
293
|
+
|
|
294
|
+
// Matching brackets
|
|
295
|
+
'.cm-matchingBracket': {
|
|
296
|
+
backgroundColor: activeBracketBg,
|
|
297
|
+
outline: `1px solid ${activeBracketBorder}`,
|
|
298
|
+
borderRadius: generalMatching.borderRadius,
|
|
299
|
+
},
|
|
300
|
+
'.cm-nonmatchingBracket': {
|
|
301
|
+
backgroundColor: `${red}40`,
|
|
302
|
+
outline: `1px solid ${invalid}`,
|
|
303
|
+
borderRadius: generalMatching.borderRadius,
|
|
304
|
+
},
|
|
305
|
+
|
|
306
|
+
// Selection matches
|
|
307
|
+
'.cm-selectionMatch': {
|
|
308
|
+
backgroundColor: selectionMatch,
|
|
309
|
+
outline: `1px solid ${base01}50`,
|
|
310
|
+
borderRadius: generalMatching.borderRadius,
|
|
311
|
+
},
|
|
312
|
+
|
|
313
|
+
// Fold placeholder
|
|
314
|
+
'.cm-foldPlaceholder': {
|
|
315
|
+
backgroundColor: tooltipBackground,
|
|
316
|
+
color: base02,
|
|
317
|
+
border: `1px dotted ${base02}70`,
|
|
318
|
+
borderRadius: generalPlaceholder.borderRadius,
|
|
319
|
+
padding: generalPlaceholder.padding,
|
|
320
|
+
margin: generalPlaceholder.margin,
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
// Focus outline
|
|
324
|
+
'&.cm-focused': {
|
|
325
|
+
outline: 'none',
|
|
326
|
+
boxShadow: `0 0 0 2px ${background}, 0 0 0 3px ${lavender}40`,
|
|
327
|
+
},
|
|
328
|
+
|
|
329
|
+
// Scrollbars
|
|
330
|
+
'& .cm-scroller::-webkit-scrollbar': {
|
|
331
|
+
width: generalScroller.width,
|
|
332
|
+
height: generalScroller.height,
|
|
333
|
+
},
|
|
334
|
+
'& .cm-scroller::-webkit-scrollbar-track': {
|
|
335
|
+
background: darkBackground,
|
|
336
|
+
},
|
|
337
|
+
'& .cm-scroller::-webkit-scrollbar-thumb': {
|
|
338
|
+
backgroundColor: base01,
|
|
339
|
+
borderRadius: generalScroller.borderRadius,
|
|
340
|
+
border: `3px solid ${darkBackground}`,
|
|
341
|
+
},
|
|
342
|
+
'& .cm-scroller::-webkit-scrollbar-thumb:hover': {
|
|
343
|
+
backgroundColor: base02,
|
|
344
|
+
},
|
|
345
|
+
|
|
346
|
+
// Ghost text
|
|
347
|
+
'.cm-ghostText': {
|
|
348
|
+
opacity: '0.5',
|
|
349
|
+
color: base02,
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
{ dark: true },
|
|
353
|
+
);
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Enhanced syntax highlighting for Catppuccin Mocha theme
|
|
357
|
+
*/
|
|
358
|
+
const catppuccinMochaHighlightStyle = HighlightStyle.define([
|
|
359
|
+
// Keywords and control flow
|
|
360
|
+
{ tag: t.keyword, color: mauve, fontWeight: 'bold' },
|
|
361
|
+
{ tag: t.controlKeyword, color: mauve, fontWeight: 'bold' },
|
|
362
|
+
{ tag: t.moduleKeyword, color: mauve, fontWeight: 'bold' },
|
|
363
|
+
|
|
364
|
+
// Names and variables
|
|
365
|
+
{ tag: [t.name, t.deleted, t.character, t.macroName], color: base04 },
|
|
366
|
+
{ tag: [t.variableName], color: base04 },
|
|
367
|
+
{ tag: [t.propertyName], color: blue, fontStyle: 'normal' },
|
|
368
|
+
|
|
369
|
+
// Classes and types
|
|
370
|
+
{ tag: [t.typeName], color: yellow },
|
|
371
|
+
{ tag: [t.className], color: yellow, fontStyle: 'italic' },
|
|
372
|
+
{ tag: [t.namespace], color: peach, fontStyle: 'italic' },
|
|
373
|
+
|
|
374
|
+
// Operators and punctuation
|
|
375
|
+
{ tag: [t.operator, t.operatorKeyword], color: sky },
|
|
376
|
+
{ tag: [t.bracket], color: base03 },
|
|
377
|
+
{ tag: [t.brace], color: teal },
|
|
378
|
+
{ tag: [t.punctuation], color: base03 },
|
|
379
|
+
|
|
380
|
+
// Functions and parameters
|
|
381
|
+
{ tag: [t.function(t.variableName), t.labelName], color: blue },
|
|
382
|
+
{ tag: [t.definition(t.function(t.variableName))], color: blue },
|
|
383
|
+
{ tag: [t.definition(t.variableName)], color: peach },
|
|
384
|
+
|
|
385
|
+
// Constants and literals
|
|
386
|
+
{ tag: t.number, color: peach },
|
|
387
|
+
{ tag: t.changed, color: yellow },
|
|
388
|
+
{ tag: t.annotation, color: red, fontStyle: 'italic' },
|
|
389
|
+
{ tag: t.modifier, color: mauve, fontStyle: 'italic' },
|
|
390
|
+
{ tag: t.self, color: red },
|
|
391
|
+
{ tag: [t.color, t.constant(t.name), t.standard(t.name)], color: peach },
|
|
392
|
+
{ tag: [t.atom, t.bool, t.special(t.variableName)], color: peach },
|
|
393
|
+
|
|
394
|
+
// Strings and regex
|
|
395
|
+
{ tag: [t.processingInstruction, t.inserted], color: green },
|
|
396
|
+
{ tag: [t.special(t.string), t.regexp], color: pink },
|
|
397
|
+
{ tag: t.string, color: green },
|
|
398
|
+
|
|
399
|
+
// Punctuation and structure
|
|
400
|
+
{ tag: t.definition(t.typeName), color: yellow, fontWeight: 'bold' },
|
|
401
|
+
{ tag: [t.definition(t.name), t.separator], color: flamingo },
|
|
402
|
+
|
|
403
|
+
// Comments and documentation
|
|
404
|
+
{ tag: t.meta, color: base02 },
|
|
405
|
+
{ tag: t.comment, fontStyle: 'italic', color: base02 },
|
|
406
|
+
{ tag: t.docComment, fontStyle: 'italic', color: base02 },
|
|
407
|
+
|
|
408
|
+
// HTML/XML elements
|
|
409
|
+
{ tag: [t.tagName], color: pink },
|
|
410
|
+
{ tag: [t.attributeName], color: yellow },
|
|
411
|
+
|
|
412
|
+
// Markdown and text formatting
|
|
413
|
+
{ tag: [t.heading], fontWeight: 'bold', color: mauve },
|
|
414
|
+
{ tag: [t.strong], fontWeight: 'bold', color: maroon },
|
|
415
|
+
{ tag: [t.emphasis], fontStyle: 'italic', color: pink },
|
|
416
|
+
|
|
417
|
+
// Links and URLs
|
|
418
|
+
{
|
|
419
|
+
tag: [t.link],
|
|
420
|
+
color: visitedLinkColor,
|
|
421
|
+
fontWeight: '500',
|
|
422
|
+
textDecoration: 'underline',
|
|
423
|
+
textUnderlinePosition: 'under',
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
tag: [t.url],
|
|
427
|
+
color: linkColor,
|
|
428
|
+
textDecoration: 'underline',
|
|
429
|
+
textUnderlineOffset: '2px',
|
|
430
|
+
},
|
|
431
|
+
|
|
432
|
+
// Special states
|
|
433
|
+
{
|
|
434
|
+
tag: [t.invalid],
|
|
435
|
+
color: red,
|
|
436
|
+
textDecoration: 'underline wavy',
|
|
437
|
+
borderBottom: `1px wavy ${red}`,
|
|
438
|
+
},
|
|
439
|
+
{ tag: [t.strikethrough], color: red, textDecoration: 'line-through' },
|
|
440
|
+
|
|
441
|
+
// Enhanced syntax highlighting
|
|
442
|
+
{ tag: t.constant(t.name), color: peach },
|
|
443
|
+
{ tag: t.deleted, color: red },
|
|
444
|
+
{ tag: t.squareBracket, color: maroon },
|
|
445
|
+
{ tag: t.angleBracket, color: sky },
|
|
446
|
+
|
|
447
|
+
// Additional specific styles
|
|
448
|
+
{ tag: t.monospace, color: teal, fontStyle: 'italic' },
|
|
449
|
+
{ tag: [t.contentSeparator], color: sapphire },
|
|
450
|
+
{ tag: t.quote, color: lavender },
|
|
451
|
+
]);
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Combined Catppuccin Mocha theme extension
|
|
455
|
+
*/
|
|
456
|
+
const catppuccinMocha: Extension = [
|
|
457
|
+
catppuccinMochaTheme,
|
|
458
|
+
syntaxHighlighting(catppuccinMochaHighlightStyle),
|
|
459
|
+
];
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Catppuccin Mocha merge revert styles configuration
|
|
463
|
+
*/
|
|
464
|
+
const catppuccinMochaMergeStyles: IMergeRevertStyles = {
|
|
465
|
+
backgroundColor: darkBackground,
|
|
466
|
+
borderColor: base02,
|
|
467
|
+
buttonColor: base04,
|
|
468
|
+
buttonHoverColor: base01,
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
export { catppuccinMocha, catppuccinMochaMergeStyles, applyMergeRevertStyles };
|
|
472
|
+
|
package/src/utils.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Helper module for styling options
|
|
2
|
+
export const generalContent = {
|
|
3
|
+
fontSize: '14px',
|
|
4
|
+
fontFamily: 'JetBrains Mono, Consolas, monospace',
|
|
5
|
+
lineHeight: '1.6',
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const generalCursor = {
|
|
9
|
+
borderLeftWidth: '2px',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const generalDiff = {
|
|
13
|
+
insertedTextDecoration: 'none',
|
|
14
|
+
deletedTextDecoration: 'line-through',
|
|
15
|
+
insertedLinePadding: '1px 3px',
|
|
16
|
+
borderRadious: '3px',
|
|
17
|
+
ins_del_linePadding: '1px 3px',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const generalGutter = {
|
|
21
|
+
border: 'none',
|
|
22
|
+
paddingRight: '8px',
|
|
23
|
+
fontSize: '0.9em',
|
|
24
|
+
fontWeight: '500',
|
|
25
|
+
lineHeight: '1.78', // Adjusted to compensate for 0.9em fontSize (1.6 / 0.9 ≈ 1.78)
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const generalPanel = {
|
|
29
|
+
border: 'none',
|
|
30
|
+
borderRadius: '4px',
|
|
31
|
+
padding: '2px 10px',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const generalLine = {
|
|
35
|
+
borderRadius: '2px',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const generalMatching = {
|
|
39
|
+
borderRadius: '2px',
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const generalPlaceholder = {
|
|
43
|
+
borderRadius: '4px',
|
|
44
|
+
padding: '0 5px',
|
|
45
|
+
margin: '0 2px',
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const generalScroller = {
|
|
49
|
+
width: '12px',
|
|
50
|
+
height: '12px',
|
|
51
|
+
borderRadius: '6px',
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const generalSearchField = {
|
|
55
|
+
borderRadius: '4px',
|
|
56
|
+
padding: '2px 6px',
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const generalTooltip = {
|
|
60
|
+
borderRadius: '4px',
|
|
61
|
+
borderRadiusSelected: '3px',
|
|
62
|
+
lineHeight: '1.3',
|
|
63
|
+
padding: '4px 8px',
|
|
64
|
+
paddingRight: '8px',
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
//---------------------------------------
|
|
68
|
+
|
|
69
|
+
// Interface for merge revert styling options
|
|
70
|
+
export interface IMergeRevertStyles {
|
|
71
|
+
backgroundColor: string
|
|
72
|
+
borderColor: string
|
|
73
|
+
buttonColor: string
|
|
74
|
+
buttonHoverColor: string
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Function to apply merge revert styles for a theme
|
|
79
|
+
* @param styles Styles for the merge revert buttons
|
|
80
|
+
* @param styles.backgroundColor Background color of the revert area
|
|
81
|
+
* @param styles.borderColor Border color of the revert area
|
|
82
|
+
* @param styles.buttonColor Color of the revert buttons
|
|
83
|
+
* @param styles.buttonHoverColor Hover color of the revert buttons
|
|
84
|
+
*/
|
|
85
|
+
export function applyMergeRevertStyles(styles: IMergeRevertStyles) {
|
|
86
|
+
// Create a stylesheet
|
|
87
|
+
const styleEl = document.createElement('style');
|
|
88
|
+
styleEl.id = 'cm-merge-revert-styles';
|
|
89
|
+
|
|
90
|
+
// Define CSS with the theme-specific values
|
|
91
|
+
styleEl.textContent = `
|
|
92
|
+
.cm-merge-revert {
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
align-items: center;
|
|
96
|
+
justify-content: flex-start;
|
|
97
|
+
padding: 4px;
|
|
98
|
+
background-color: ${styles.backgroundColor};
|
|
99
|
+
border-left: 1px solid ${styles.borderColor};
|
|
100
|
+
border-right: 1px solid ${styles.borderColor};
|
|
101
|
+
width: 32px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.cm-merge-revert button {
|
|
105
|
+
width: 100%;
|
|
106
|
+
height: auto;
|
|
107
|
+
background-color: transparent;
|
|
108
|
+
border: none;
|
|
109
|
+
color: ${styles.buttonColor};
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
margin: 0 auto;
|
|
112
|
+
font-size: 20px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.cm-merge-revert button:hover {
|
|
116
|
+
background-color: ${styles.buttonHoverColor};
|
|
117
|
+
}
|
|
118
|
+
`;
|
|
119
|
+
|
|
120
|
+
// Remove any existing merge styles
|
|
121
|
+
const existingStyle = document.getElementById('cm-merge-revert-styles');
|
|
122
|
+
if (existingStyle) existingStyle.remove();
|
|
123
|
+
|
|
124
|
+
// Add the new styles
|
|
125
|
+
document.head.appendChild(styleEl);
|
|
126
|
+
}
|