@fsegurai/codemirror-theme-android-studio 6.2.0-beta.4 → 6.2.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/dist/index.cjs +189 -36
- package/dist/index.d.cts +19 -8
- package/dist/index.d.ts +19 -8
- package/dist/index.js +156 -3
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,107 @@
|
|
|
3
3
|
var view = require('@codemirror/view');
|
|
4
4
|
var language = require('@codemirror/language');
|
|
5
5
|
var highlight = require('@lezer/highlight');
|
|
6
|
-
|
|
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
|
+
border: 'none',
|
|
29
|
+
borderRadius: '4px',
|
|
30
|
+
padding: '2px 10px',
|
|
31
|
+
};
|
|
32
|
+
const generalLine = {
|
|
33
|
+
borderRadius: '2px',
|
|
34
|
+
};
|
|
35
|
+
const generalMatching = {
|
|
36
|
+
borderRadius: '2px',
|
|
37
|
+
};
|
|
38
|
+
const generalPlaceholder = {
|
|
39
|
+
borderRadius: '4px',
|
|
40
|
+
padding: '0 5px',
|
|
41
|
+
margin: '0 2px',
|
|
42
|
+
};
|
|
43
|
+
const generalScroller = {
|
|
44
|
+
width: '12px',
|
|
45
|
+
height: '12px',
|
|
46
|
+
borderRadius: '6px',
|
|
47
|
+
};
|
|
48
|
+
const generalSearchField = {
|
|
49
|
+
borderRadius: '4px',
|
|
50
|
+
padding: '2px 6px',
|
|
51
|
+
};
|
|
52
|
+
const generalTooltip = {
|
|
53
|
+
borderRadius: '4px',
|
|
54
|
+
borderRadiusSelected: '3px',
|
|
55
|
+
lineHeight: '1.3',
|
|
56
|
+
padding: '4px 8px',
|
|
57
|
+
paddingRight: '8px',
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Function to apply merge revert styles for a theme
|
|
61
|
+
* @param styles Styles for the merge revert buttons
|
|
62
|
+
* @param styles.backgroundColor Background color of the revert area
|
|
63
|
+
* @param styles.borderColor Border color of the revert area
|
|
64
|
+
* @param styles.buttonColor Color of the revert buttons
|
|
65
|
+
* @param styles.buttonHoverColor Hover color of the revert buttons
|
|
66
|
+
*/
|
|
67
|
+
function applyMergeRevertStyles(styles) {
|
|
68
|
+
// Create a stylesheet
|
|
69
|
+
const styleEl = document.createElement('style');
|
|
70
|
+
styleEl.id = 'cm-merge-revert-styles';
|
|
71
|
+
// Define CSS with the theme-specific values
|
|
72
|
+
styleEl.textContent = `
|
|
73
|
+
.cm-merge-revert {
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
align-items: center;
|
|
77
|
+
justify-content: flex-start;
|
|
78
|
+
padding: 4px;
|
|
79
|
+
background-color: ${styles.backgroundColor};
|
|
80
|
+
border-left: 1px solid ${styles.borderColor};
|
|
81
|
+
border-right: 1px solid ${styles.borderColor};
|
|
82
|
+
width: 32px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.cm-merge-revert button {
|
|
86
|
+
width: 100%;
|
|
87
|
+
height: auto;
|
|
88
|
+
background-color: transparent;
|
|
89
|
+
border: none;
|
|
90
|
+
color: ${styles.buttonColor};
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
margin: 0 auto;
|
|
93
|
+
font-size: 20px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.cm-merge-revert button:hover {
|
|
97
|
+
background-color: ${styles.buttonHoverColor};
|
|
98
|
+
}
|
|
99
|
+
`;
|
|
100
|
+
// Remove any existing merge styles
|
|
101
|
+
const existingStyle = document.getElementById('cm-merge-revert-styles');
|
|
102
|
+
if (existingStyle)
|
|
103
|
+
existingStyle.remove();
|
|
104
|
+
// Add the new styles
|
|
105
|
+
document.head.appendChild(styleEl);
|
|
106
|
+
}
|
|
7
107
|
|
|
8
108
|
/**
|
|
9
109
|
* Enhanced Android Studio theme color palette
|
|
@@ -38,7 +138,12 @@ selectionForeground = '#ffffff', // Selection text color
|
|
|
38
138
|
highlightBackground = '#323232', // Active line highlight
|
|
39
139
|
gutterBackground = '#313335', // Gutter background
|
|
40
140
|
tooltipBackground = base03, // Tooltip background
|
|
41
|
-
activeBracketBg = '#3b514d', activeBracketBorder = '#43705c', darkBackground = '#313335'
|
|
141
|
+
activeBracketBg = '#3b514d', activeBracketBorder = '#43705c', darkBackground = '#313335',
|
|
142
|
+
// Diff/merge specific colors
|
|
143
|
+
addedBackground = '#294436', // Dark green for insertions, matching IntelliJ
|
|
144
|
+
removedBackground = '#484a4a', // Dark gray/red for deletions
|
|
145
|
+
addedText = '#6a8759', // Matching the string color for added text
|
|
146
|
+
removedText = '#cc7832'; // Using the keyword orange for removed text
|
|
42
147
|
/**
|
|
43
148
|
* Enhanced editor theme styles for Android Studio
|
|
44
149
|
*/
|
|
@@ -47,17 +152,17 @@ const androidStudioTheme = view.EditorView.theme({
|
|
|
47
152
|
'&': {
|
|
48
153
|
color: base01,
|
|
49
154
|
backgroundColor: base00,
|
|
50
|
-
fontSize:
|
|
51
|
-
fontFamily:
|
|
155
|
+
fontSize: generalContent.fontSize,
|
|
156
|
+
fontFamily: generalContent.fontFamily,
|
|
52
157
|
},
|
|
53
158
|
// Content and cursor
|
|
54
159
|
'.cm-content': {
|
|
55
160
|
caretColor: cursor,
|
|
56
|
-
lineHeight:
|
|
161
|
+
lineHeight: generalContent.lineHeight,
|
|
57
162
|
},
|
|
58
163
|
'.cm-cursor, .cm-dropCursor': {
|
|
59
164
|
borderLeftColor: cursor,
|
|
60
|
-
borderLeftWidth:
|
|
165
|
+
borderLeftWidth: generalCursor.borderLeftWidth,
|
|
61
166
|
},
|
|
62
167
|
'.cm-fat-cursor': {
|
|
63
168
|
backgroundColor: `${cursor}99`,
|
|
@@ -71,7 +176,7 @@ const androidStudioTheme = view.EditorView.theme({
|
|
|
71
176
|
'.cm-searchMatch': {
|
|
72
177
|
backgroundColor: '#32593d',
|
|
73
178
|
outline: '1px solid #ffffff',
|
|
74
|
-
borderRadius:
|
|
179
|
+
borderRadius: generalSearchField.borderRadius,
|
|
75
180
|
'& span': {
|
|
76
181
|
color: selectionForeground,
|
|
77
182
|
},
|
|
@@ -79,15 +184,15 @@ const androidStudioTheme = view.EditorView.theme({
|
|
|
79
184
|
'.cm-searchMatch.cm-searchMatch-selected': {
|
|
80
185
|
backgroundColor: '#375580',
|
|
81
186
|
color: selectionForeground,
|
|
82
|
-
padding:
|
|
187
|
+
padding: generalSearchField.padding,
|
|
83
188
|
'& span': {
|
|
84
189
|
color: selectionForeground,
|
|
85
190
|
},
|
|
86
191
|
},
|
|
87
192
|
'.cm-search.cm-panel.cm-textfield': {
|
|
88
193
|
color: base01,
|
|
89
|
-
borderRadius:
|
|
90
|
-
padding:
|
|
194
|
+
borderRadius: generalSearchField.borderRadius,
|
|
195
|
+
padding: generalSearchField.padding,
|
|
91
196
|
},
|
|
92
197
|
// Panels
|
|
93
198
|
'.cm-panels': {
|
|
@@ -103,9 +208,9 @@ const androidStudioTheme = view.EditorView.theme({
|
|
|
103
208
|
'.cm-panel button': {
|
|
104
209
|
backgroundColor: darkBackground,
|
|
105
210
|
color: base01,
|
|
106
|
-
border:
|
|
107
|
-
borderRadius:
|
|
108
|
-
padding:
|
|
211
|
+
border: generalPanel.border,
|
|
212
|
+
borderRadius: generalPanel.borderRadius,
|
|
213
|
+
padding: generalPanel.padding,
|
|
109
214
|
},
|
|
110
215
|
'.cm-panel button:hover': {
|
|
111
216
|
backgroundColor: '#404040',
|
|
@@ -113,26 +218,26 @@ const androidStudioTheme = view.EditorView.theme({
|
|
|
113
218
|
// Line highlighting
|
|
114
219
|
'.cm-activeLine': {
|
|
115
220
|
backgroundColor: '#32323221',
|
|
116
|
-
borderRadius:
|
|
221
|
+
borderRadius: generalLine.borderRadius,
|
|
117
222
|
},
|
|
118
223
|
// Gutters
|
|
119
224
|
'.cm-gutters': {
|
|
120
225
|
backgroundColor: gutterBackground,
|
|
121
226
|
color: base04,
|
|
122
|
-
border:
|
|
227
|
+
border: generalGutter.border,
|
|
123
228
|
borderRight: '1px solid #3f3f3f',
|
|
124
|
-
paddingRight:
|
|
229
|
+
paddingRight: generalGutter.paddingRight,
|
|
125
230
|
},
|
|
126
231
|
'.cm-activeLineGutter': {
|
|
127
232
|
backgroundColor: highlightBackground,
|
|
128
233
|
color: '#c0c0c0',
|
|
129
|
-
fontWeight:
|
|
234
|
+
fontWeight: generalGutter.fontWeight,
|
|
130
235
|
},
|
|
131
236
|
'.cm-lineNumbers': {
|
|
132
|
-
fontSize:
|
|
237
|
+
fontSize: generalGutter.fontSize,
|
|
133
238
|
},
|
|
134
239
|
'.cm-foldGutter': {
|
|
135
|
-
fontSize:
|
|
240
|
+
fontSize: generalGutter.fontSize,
|
|
136
241
|
},
|
|
137
242
|
'.cm-foldGutter .cm-gutterElement': {
|
|
138
243
|
color: base04,
|
|
@@ -141,27 +246,66 @@ const androidStudioTheme = view.EditorView.theme({
|
|
|
141
246
|
'.cm-foldGutter .cm-gutterElement:hover': {
|
|
142
247
|
color: base01,
|
|
143
248
|
},
|
|
249
|
+
// Diff/Merge View Styles
|
|
250
|
+
// Inserted/Added Content
|
|
251
|
+
'.cm-insertedLine': {
|
|
252
|
+
textDecoration: generalDiff.insertedTextDecoration,
|
|
253
|
+
backgroundColor: addedBackground,
|
|
254
|
+
color: addedText,
|
|
255
|
+
padding: generalDiff.insertedLinePadding,
|
|
256
|
+
borderRadius: generalDiff.borderRadious,
|
|
257
|
+
},
|
|
258
|
+
'ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))': {
|
|
259
|
+
textDecoration: generalDiff.insertedTextDecoration,
|
|
260
|
+
backgroundColor: `${addedBackground} !important`,
|
|
261
|
+
color: addedText,
|
|
262
|
+
padding: generalDiff.insertedLinePadding,
|
|
263
|
+
borderRadius: generalDiff.borderRadious,
|
|
264
|
+
border: `1px solid ${addedText}40`,
|
|
265
|
+
},
|
|
266
|
+
'ins.cm-insertedLine .cm-changedText': {
|
|
267
|
+
background: 'transparent !important',
|
|
268
|
+
},
|
|
269
|
+
// Deleted/Removed Content
|
|
270
|
+
'.cm-deletedLine': {
|
|
271
|
+
textDecoration: generalDiff.deletedTextDecoration,
|
|
272
|
+
backgroundColor: removedBackground,
|
|
273
|
+
color: removedText,
|
|
274
|
+
padding: generalDiff.insertedLinePadding,
|
|
275
|
+
borderRadius: generalDiff.borderRadious,
|
|
276
|
+
},
|
|
277
|
+
'del.cm-deletedLine, del, del:not(:has(.cm-deletedText))': {
|
|
278
|
+
textDecoration: generalDiff.deletedTextDecoration,
|
|
279
|
+
backgroundColor: `${removedBackground} !important`,
|
|
280
|
+
color: removedText,
|
|
281
|
+
padding: generalDiff.insertedLinePadding,
|
|
282
|
+
borderRadius: generalDiff.borderRadious,
|
|
283
|
+
border: `1px solid ${removedText}40`,
|
|
284
|
+
},
|
|
285
|
+
'del .cm-deletedText, del .cm-changedText': {
|
|
286
|
+
background: 'transparent !important',
|
|
287
|
+
},
|
|
144
288
|
// Tooltips and autocomplete
|
|
145
289
|
'.cm-tooltip': {
|
|
146
290
|
backgroundColor: tooltipBackground,
|
|
147
291
|
border: '1px solid #5b5b5b',
|
|
148
|
-
borderRadius:
|
|
149
|
-
padding:
|
|
292
|
+
borderRadius: generalTooltip.borderRadius,
|
|
293
|
+
padding: generalTooltip.padding,
|
|
150
294
|
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.3)',
|
|
151
295
|
},
|
|
152
296
|
'.cm-tooltip-autocomplete': {
|
|
153
297
|
'& > ul > li': {
|
|
154
|
-
padding:
|
|
155
|
-
lineHeight:
|
|
298
|
+
padding: generalTooltip.padding,
|
|
299
|
+
lineHeight: generalTooltip.lineHeight,
|
|
156
300
|
},
|
|
157
301
|
'& > ul > li[aria-selected]': {
|
|
158
302
|
backgroundColor: selectionBackground,
|
|
159
303
|
color: selectionForeground,
|
|
160
|
-
borderRadius:
|
|
304
|
+
borderRadius: generalTooltip.borderRadiusSelected,
|
|
161
305
|
},
|
|
162
306
|
'& > ul > li > span.cm-completionIcon': {
|
|
163
307
|
color: base04,
|
|
164
|
-
paddingRight:
|
|
308
|
+
paddingRight: generalTooltip.paddingRight,
|
|
165
309
|
},
|
|
166
310
|
'& > ul > li > span.cm-completionDetail': {
|
|
167
311
|
color: base04,
|
|
@@ -198,27 +342,27 @@ const androidStudioTheme = view.EditorView.theme({
|
|
|
198
342
|
'.cm-matchingBracket': {
|
|
199
343
|
backgroundColor: activeBracketBg,
|
|
200
344
|
outline: `1px solid ${activeBracketBorder}`,
|
|
201
|
-
borderRadius:
|
|
345
|
+
borderRadius: generalMatching.borderRadius,
|
|
202
346
|
},
|
|
203
347
|
'.cm-nonmatchingBracket': {
|
|
204
348
|
backgroundColor: '#53383e',
|
|
205
349
|
outline: `1px solid ${invalid}`,
|
|
206
|
-
borderRadius:
|
|
350
|
+
borderRadius: generalMatching.borderRadius,
|
|
207
351
|
},
|
|
208
352
|
// Selection matches
|
|
209
353
|
'.cm-selectionMatch': {
|
|
210
354
|
backgroundColor: '#32593d40',
|
|
211
355
|
outline: `1px solid ${base0D}`,
|
|
212
|
-
borderRadius:
|
|
356
|
+
borderRadius: generalMatching.borderRadius,
|
|
213
357
|
},
|
|
214
358
|
// Fold placeholder
|
|
215
359
|
'.cm-foldPlaceholder': {
|
|
216
360
|
backgroundColor: tooltipBackground,
|
|
217
361
|
color: '#a1a1a1',
|
|
218
362
|
border: `1px dotted ${base04}`,
|
|
219
|
-
borderRadius:
|
|
220
|
-
padding:
|
|
221
|
-
margin:
|
|
363
|
+
borderRadius: generalPlaceholder.borderRadius,
|
|
364
|
+
padding: generalPlaceholder.padding,
|
|
365
|
+
margin: generalPlaceholder.margin,
|
|
222
366
|
},
|
|
223
367
|
// Focus outline
|
|
224
368
|
'&.cm-focused': {
|
|
@@ -227,15 +371,15 @@ const androidStudioTheme = view.EditorView.theme({
|
|
|
227
371
|
},
|
|
228
372
|
// Scrollbars
|
|
229
373
|
'& .cm-scroller::-webkit-scrollbar': {
|
|
230
|
-
width:
|
|
231
|
-
height:
|
|
374
|
+
width: generalScroller.width,
|
|
375
|
+
height: generalScroller.height,
|
|
232
376
|
},
|
|
233
377
|
'& .cm-scroller::-webkit-scrollbar-track': {
|
|
234
378
|
background: darkBackground,
|
|
235
379
|
},
|
|
236
380
|
'& .cm-scroller::-webkit-scrollbar-thumb': {
|
|
237
381
|
backgroundColor: '#5a5a5a',
|
|
238
|
-
borderRadius:
|
|
382
|
+
borderRadius: generalScroller.borderRadius,
|
|
239
383
|
border: `3px solid ${darkBackground}`,
|
|
240
384
|
},
|
|
241
385
|
'& .cm-scroller::-webkit-scrollbar-thumb:hover': {
|
|
@@ -319,7 +463,16 @@ const androidStudio = [
|
|
|
319
463
|
androidStudioTheme,
|
|
320
464
|
language.syntaxHighlighting(androidStudioHighlightStyle),
|
|
321
465
|
];
|
|
466
|
+
/**
|
|
467
|
+
* Android Studio merge revert styles configuration
|
|
468
|
+
*/
|
|
469
|
+
const androidStudioMergeStyles = {
|
|
470
|
+
backgroundColor: darkBackground,
|
|
471
|
+
borderColor: '#5b5b5b',
|
|
472
|
+
buttonColor: base01,
|
|
473
|
+
buttonHoverColor: '#414141',
|
|
474
|
+
};
|
|
322
475
|
|
|
323
476
|
exports.androidStudio = androidStudio;
|
|
324
|
-
exports.
|
|
325
|
-
exports.
|
|
477
|
+
exports.androidStudioMergeStyles = androidStudioMergeStyles;
|
|
478
|
+
exports.applyMergeRevertStyles = applyMergeRevertStyles;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
import { Extension } from '@codemirror/state';
|
|
2
|
-
import { HighlightStyle } from '@codemirror/language';
|
|
3
2
|
|
|
3
|
+
interface IMergeRevertStyles {
|
|
4
|
+
backgroundColor: string;
|
|
5
|
+
borderColor: string;
|
|
6
|
+
buttonColor: string;
|
|
7
|
+
buttonHoverColor: string;
|
|
8
|
+
}
|
|
4
9
|
/**
|
|
5
|
-
*
|
|
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
|
|
6
16
|
*/
|
|
7
|
-
declare
|
|
8
|
-
|
|
9
|
-
* Enhanced syntax highlighting for the Android Studio theme
|
|
10
|
-
*/
|
|
11
|
-
declare const androidStudioHighlightStyle: HighlightStyle;
|
|
17
|
+
declare function applyMergeRevertStyles(styles: IMergeRevertStyles): void;
|
|
18
|
+
|
|
12
19
|
/**
|
|
13
20
|
* Combined Android Studio theme extension
|
|
14
21
|
*/
|
|
15
22
|
declare const androidStudio: Extension;
|
|
23
|
+
/**
|
|
24
|
+
* Android Studio merge revert styles configuration
|
|
25
|
+
*/
|
|
26
|
+
declare const androidStudioMergeStyles: IMergeRevertStyles;
|
|
16
27
|
|
|
17
|
-
export { androidStudio,
|
|
28
|
+
export { androidStudio, androidStudioMergeStyles, applyMergeRevertStyles };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
import { Extension } from '@codemirror/state';
|
|
2
|
-
import { HighlightStyle } from '@codemirror/language';
|
|
3
2
|
|
|
3
|
+
interface IMergeRevertStyles {
|
|
4
|
+
backgroundColor: string;
|
|
5
|
+
borderColor: string;
|
|
6
|
+
buttonColor: string;
|
|
7
|
+
buttonHoverColor: string;
|
|
8
|
+
}
|
|
4
9
|
/**
|
|
5
|
-
*
|
|
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
|
|
6
16
|
*/
|
|
7
|
-
declare
|
|
8
|
-
|
|
9
|
-
* Enhanced syntax highlighting for the Android Studio theme
|
|
10
|
-
*/
|
|
11
|
-
declare const androidStudioHighlightStyle: HighlightStyle;
|
|
17
|
+
declare function applyMergeRevertStyles(styles: IMergeRevertStyles): void;
|
|
18
|
+
|
|
12
19
|
/**
|
|
13
20
|
* Combined Android Studio theme extension
|
|
14
21
|
*/
|
|
15
22
|
declare const androidStudio: Extension;
|
|
23
|
+
/**
|
|
24
|
+
* Android Studio merge revert styles configuration
|
|
25
|
+
*/
|
|
26
|
+
declare const androidStudioMergeStyles: IMergeRevertStyles;
|
|
16
27
|
|
|
17
|
-
export { androidStudio,
|
|
28
|
+
export { androidStudio, androidStudioMergeStyles, applyMergeRevertStyles };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,107 @@
|
|
|
1
1
|
import { EditorView } from '@codemirror/view';
|
|
2
2
|
import { HighlightStyle, syntaxHighlighting } from '@codemirror/language';
|
|
3
3
|
import { tags } from '@lezer/highlight';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
// Helper module for styling options
|
|
6
|
+
const generalContent = {
|
|
7
|
+
fontSize: '14px',
|
|
8
|
+
fontFamily: 'JetBrains Mono, Consolas, monospace',
|
|
9
|
+
lineHeight: '1.6',
|
|
10
|
+
};
|
|
11
|
+
const generalCursor = {
|
|
12
|
+
borderLeftWidth: '2px',
|
|
13
|
+
};
|
|
14
|
+
const generalDiff = {
|
|
15
|
+
insertedTextDecoration: 'none',
|
|
16
|
+
deletedTextDecoration: 'line-through',
|
|
17
|
+
insertedLinePadding: '1px 3px',
|
|
18
|
+
borderRadious: '3px'};
|
|
19
|
+
const generalGutter = {
|
|
20
|
+
border: 'none',
|
|
21
|
+
paddingRight: '8px',
|
|
22
|
+
fontSize: '0.9em',
|
|
23
|
+
fontWeight: '500',
|
|
24
|
+
};
|
|
25
|
+
const generalPanel = {
|
|
26
|
+
border: 'none',
|
|
27
|
+
borderRadius: '4px',
|
|
28
|
+
padding: '2px 10px',
|
|
29
|
+
};
|
|
30
|
+
const generalLine = {
|
|
31
|
+
borderRadius: '2px',
|
|
32
|
+
};
|
|
33
|
+
const generalMatching = {
|
|
34
|
+
borderRadius: '2px',
|
|
35
|
+
};
|
|
36
|
+
const generalPlaceholder = {
|
|
37
|
+
borderRadius: '4px',
|
|
38
|
+
padding: '0 5px',
|
|
39
|
+
margin: '0 2px',
|
|
40
|
+
};
|
|
41
|
+
const generalScroller = {
|
|
42
|
+
width: '12px',
|
|
43
|
+
height: '12px',
|
|
44
|
+
borderRadius: '6px',
|
|
45
|
+
};
|
|
46
|
+
const generalSearchField = {
|
|
47
|
+
borderRadius: '4px',
|
|
48
|
+
padding: '2px 6px',
|
|
49
|
+
};
|
|
50
|
+
const generalTooltip = {
|
|
51
|
+
borderRadius: '4px',
|
|
52
|
+
borderRadiusSelected: '3px',
|
|
53
|
+
lineHeight: '1.3',
|
|
54
|
+
padding: '4px 8px',
|
|
55
|
+
paddingRight: '8px',
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Function to apply merge revert styles for a theme
|
|
59
|
+
* @param styles Styles for the merge revert buttons
|
|
60
|
+
* @param styles.backgroundColor Background color of the revert area
|
|
61
|
+
* @param styles.borderColor Border color of the revert area
|
|
62
|
+
* @param styles.buttonColor Color of the revert buttons
|
|
63
|
+
* @param styles.buttonHoverColor Hover color of the revert buttons
|
|
64
|
+
*/
|
|
65
|
+
function applyMergeRevertStyles(styles) {
|
|
66
|
+
// Create a stylesheet
|
|
67
|
+
const styleEl = document.createElement('style');
|
|
68
|
+
styleEl.id = 'cm-merge-revert-styles';
|
|
69
|
+
// Define CSS with the theme-specific values
|
|
70
|
+
styleEl.textContent = `
|
|
71
|
+
.cm-merge-revert {
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: flex-start;
|
|
76
|
+
padding: 4px;
|
|
77
|
+
background-color: ${styles.backgroundColor};
|
|
78
|
+
border-left: 1px solid ${styles.borderColor};
|
|
79
|
+
border-right: 1px solid ${styles.borderColor};
|
|
80
|
+
width: 32px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.cm-merge-revert button {
|
|
84
|
+
width: 100%;
|
|
85
|
+
height: auto;
|
|
86
|
+
background-color: transparent;
|
|
87
|
+
border: none;
|
|
88
|
+
color: ${styles.buttonColor};
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
margin: 0 auto;
|
|
91
|
+
font-size: 20px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.cm-merge-revert button:hover {
|
|
95
|
+
background-color: ${styles.buttonHoverColor};
|
|
96
|
+
}
|
|
97
|
+
`;
|
|
98
|
+
// Remove any existing merge styles
|
|
99
|
+
const existingStyle = document.getElementById('cm-merge-revert-styles');
|
|
100
|
+
if (existingStyle)
|
|
101
|
+
existingStyle.remove();
|
|
102
|
+
// Add the new styles
|
|
103
|
+
document.head.appendChild(styleEl);
|
|
104
|
+
}
|
|
5
105
|
|
|
6
106
|
/**
|
|
7
107
|
* Enhanced Android Studio theme color palette
|
|
@@ -36,7 +136,12 @@ selectionForeground = '#ffffff', // Selection text color
|
|
|
36
136
|
highlightBackground = '#323232', // Active line highlight
|
|
37
137
|
gutterBackground = '#313335', // Gutter background
|
|
38
138
|
tooltipBackground = base03, // Tooltip background
|
|
39
|
-
activeBracketBg = '#3b514d', activeBracketBorder = '#43705c', darkBackground = '#313335'
|
|
139
|
+
activeBracketBg = '#3b514d', activeBracketBorder = '#43705c', darkBackground = '#313335',
|
|
140
|
+
// Diff/merge specific colors
|
|
141
|
+
addedBackground = '#294436', // Dark green for insertions, matching IntelliJ
|
|
142
|
+
removedBackground = '#484a4a', // Dark gray/red for deletions
|
|
143
|
+
addedText = '#6a8759', // Matching the string color for added text
|
|
144
|
+
removedText = '#cc7832'; // Using the keyword orange for removed text
|
|
40
145
|
/**
|
|
41
146
|
* Enhanced editor theme styles for Android Studio
|
|
42
147
|
*/
|
|
@@ -139,6 +244,45 @@ const androidStudioTheme = /*@__PURE__*/EditorView.theme({
|
|
|
139
244
|
'.cm-foldGutter .cm-gutterElement:hover': {
|
|
140
245
|
color: base01,
|
|
141
246
|
},
|
|
247
|
+
// Diff/Merge View Styles
|
|
248
|
+
// Inserted/Added Content
|
|
249
|
+
'.cm-insertedLine': {
|
|
250
|
+
textDecoration: generalDiff.insertedTextDecoration,
|
|
251
|
+
backgroundColor: addedBackground,
|
|
252
|
+
color: addedText,
|
|
253
|
+
padding: generalDiff.insertedLinePadding,
|
|
254
|
+
borderRadius: generalDiff.borderRadious,
|
|
255
|
+
},
|
|
256
|
+
'ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))': {
|
|
257
|
+
textDecoration: generalDiff.insertedTextDecoration,
|
|
258
|
+
backgroundColor: `${addedBackground} !important`,
|
|
259
|
+
color: addedText,
|
|
260
|
+
padding: generalDiff.insertedLinePadding,
|
|
261
|
+
borderRadius: generalDiff.borderRadious,
|
|
262
|
+
border: `1px solid ${addedText}40`,
|
|
263
|
+
},
|
|
264
|
+
'ins.cm-insertedLine .cm-changedText': {
|
|
265
|
+
background: 'transparent !important',
|
|
266
|
+
},
|
|
267
|
+
// Deleted/Removed Content
|
|
268
|
+
'.cm-deletedLine': {
|
|
269
|
+
textDecoration: generalDiff.deletedTextDecoration,
|
|
270
|
+
backgroundColor: removedBackground,
|
|
271
|
+
color: removedText,
|
|
272
|
+
padding: generalDiff.insertedLinePadding,
|
|
273
|
+
borderRadius: generalDiff.borderRadious,
|
|
274
|
+
},
|
|
275
|
+
'del.cm-deletedLine, del, del:not(:has(.cm-deletedText))': {
|
|
276
|
+
textDecoration: generalDiff.deletedTextDecoration,
|
|
277
|
+
backgroundColor: `${removedBackground} !important`,
|
|
278
|
+
color: removedText,
|
|
279
|
+
padding: generalDiff.insertedLinePadding,
|
|
280
|
+
borderRadius: generalDiff.borderRadious,
|
|
281
|
+
border: `1px solid ${removedText}40`,
|
|
282
|
+
},
|
|
283
|
+
'del .cm-deletedText, del .cm-changedText': {
|
|
284
|
+
background: 'transparent !important',
|
|
285
|
+
},
|
|
142
286
|
// Tooltips and autocomplete
|
|
143
287
|
'.cm-tooltip': {
|
|
144
288
|
backgroundColor: tooltipBackground,
|
|
@@ -317,5 +461,14 @@ const androidStudio = [
|
|
|
317
461
|
androidStudioTheme,
|
|
318
462
|
/*@__PURE__*/syntaxHighlighting(androidStudioHighlightStyle),
|
|
319
463
|
];
|
|
464
|
+
/**
|
|
465
|
+
* Android Studio merge revert styles configuration
|
|
466
|
+
*/
|
|
467
|
+
const androidStudioMergeStyles = {
|
|
468
|
+
backgroundColor: darkBackground,
|
|
469
|
+
borderColor: '#5b5b5b',
|
|
470
|
+
buttonColor: base01,
|
|
471
|
+
buttonHoverColor: '#414141',
|
|
472
|
+
};
|
|
320
473
|
|
|
321
|
-
export { androidStudio,
|
|
474
|
+
export { androidStudio, androidStudioMergeStyles, applyMergeRevertStyles };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fsegurai/codemirror-theme-android-studio",
|
|
3
3
|
"description": "Android Studio theme for the CodeMirror code editor",
|
|
4
|
-
"version": "6.2.0
|
|
4
|
+
"version": "6.2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"exports": {
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"editor",
|
|
20
|
+
"diff",
|
|
21
|
+
"diff-editor",
|
|
20
22
|
"code",
|
|
21
23
|
"codemirror",
|
|
22
24
|
"theme",
|
|
@@ -36,8 +38,7 @@
|
|
|
36
38
|
"@lezer/highlight": "^1.0.0",
|
|
37
39
|
"@codemirror/language": "^6.0.0",
|
|
38
40
|
"@codemirror/state": "^6.0.0",
|
|
39
|
-
"@codemirror/view": "^6.0.0"
|
|
40
|
-
"@fsegurai/codemirror-theme-utils": "6.2.0-beta.3"
|
|
41
|
+
"@codemirror/view": "^6.0.0"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@codemirror/buildhelper": "^1.0.2"
|