-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcssTemplates.js
More file actions
1552 lines (1328 loc) · 46.5 KB
/
cssTemplates.js
File metadata and controls
1552 lines (1328 loc) · 46.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* cssTemplates.js
*
* CSS Template Strings for CSSGnomme Theme Overlay Generation
* Separated from overlayThemeManager.js for better organization and string pooling
* OPTIMIZATION: Reusable templates reduce memory allocation during theme generation
*/
/* exported CSSTemplates */
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Constants = Me.imports.constants.Constants;
/**
* CSS Template Generator
* Provides reusable CSS template strings with parameter substitution
* All templates are cached in memory for reuse across multiple theme generations
*/
var CSSTemplates = class CSSTemplates {
/**
* Initialize CSS template cache
* Templates are compiled once and reused for performance
*/
constructor() {
// Cache compiled templates for reuse
this._templateCache = new Map();
}
// ===== GTK THEME IMPORT TEMPLATES =====
/**
* Generate GTK theme import statement
* @param {string} sourceThemePath - Path to source theme CSS
* @param {boolean} isDark - Is dark variant
* @returns {string} CSS import statement
*/
getGtkImport(sourceThemePath, isDark) {
const variant = isDark ? 'dark' : 'light';
return `/* Base theme import - tint removed, original styles preserved */\n@import url('${sourceThemePath}');\n\n`;
}
/**
* Generate GTK base CSS wrapper
* @param {string} version - GTK version (gtk-3.0, gtk-4.0)
* @param {string} modifiedCss - Modified CSS content
* @returns {string} Complete CSS with header
*/
getGtkBaseCssWrapper(version, modifiedCss) {
return `/* CSSGnomme Overlay - ${version} Base Theme
* Original theme CSS with Zorin tint colors removed
* Preserves all other theme styling
*/
${modifiedCss}
`;
}
// ===== PANEL & POPUP COLOR OVERRIDES =====
/**
* Generate panel color override CSS
* @param {string} panelColor - Panel color (rgba format)
* @param {number} opacity - Panel opacity (0-1)
* @param {boolean} applyRadius - Apply border radius
* @param {number} borderRadius - Border radius value
* @returns {string} Panel override CSS
*/
getPanelColorOverride(panelColor, opacity, applyRadius, borderRadius) {
// Cache key for this combination
const cacheKey = `panel_${panelColor}_${opacity}_${applyRadius}_${borderRadius}`;
if (this._templateCache.has(cacheKey)) {
return this._templateCache.get(cacheKey);
}
const radiusRule = applyRadius ? `border-radius: ${borderRadius}px;` : '';
const css = `
/* Panel Background Override */
.panel {
background-color: ${panelColor} !important;
${radiusRule}
}
`;
this._templateCache.set(cacheKey, css);
return css;
}
/**
* Generate popup menu color override CSS
* @param {string} popupColor - Popup color (rgba format)
* @param {number} opacity - Popup opacity (0-1)
* @param {boolean} applyRadius - Apply border radius
* @param {number} borderRadius - Border radius value
* @returns {string} Popup override CSS
*/
getPopupColorOverride(popupColor, opacity, applyRadius, borderRadius) {
const cacheKey = `popup_${popupColor}_${opacity}_${applyRadius}_${borderRadius}`;
if (this._templateCache.has(cacheKey)) {
return this._templateCache.get(cacheKey);
}
const radiusRule = applyRadius ? `border-radius: ${borderRadius}px;` : '';
const css = `
/* Popup Menu Background Override */
.popup-menu,
.popup-menu-content {
background-color: ${popupColor} !important;
${radiusRule}
}
`;
this._templateCache.set(cacheKey, css);
return css;
}
// ===== BLUR EFFECTS =====
/**
* Generate backdrop-filter CSS only (for flexible usage)
* @param {number} radius - Blur radius
* @param {number} saturate - Saturation multiplier
* @param {number} contrast - Contrast multiplier
* @param {number} brightness - Brightness multiplier
* @returns {string} Backdrop-filter CSS or empty string if disabled
*/
getBackdropFilter(radius, saturate, contrast, brightness) {
if (radius <= 0) return "";
const cacheKey = `backdrop_${radius}_${saturate}_${contrast}_${brightness}`;
if (this._templateCache.has(cacheKey)) {
return this._templateCache.get(cacheKey);
}
const css = `backdrop-filter: blur(${radius}px) saturate(${saturate}) contrast(${contrast}) brightness(${brightness}) !important;`;
this._templateCache.set(cacheKey, css);
return css;
}
// ===== GNOME SHELL SPECIFIC =====
/**
* Generate Shell panel styling
* @param {string} panelColor - Panel background color
* @param {boolean} applyRadius - Apply border radius
* @param {number} borderRadius - Border radius value
* @returns {string} Shell panel CSS
*/
getShellPanelStyle(panelColor, applyRadius, borderRadius) {
const cacheKey = `shell_panel_${panelColor}_${applyRadius}_${borderRadius}`;
if (this._templateCache.has(cacheKey)) {
return this._templateCache.get(cacheKey);
}
const radiusRule = applyRadius ? `border-radius: ${borderRadius}px;` : '';
const css = `
/* GNOME Shell Panel */
#panel {
background-color: ${panelColor} !important;
${radiusRule}
}
`;
this._templateCache.set(cacheKey, css);
return css;
}
/**
* Generate Shell popup menu styling
* @param {string} popupColor - Popup background color
* @param {boolean} applyRadius - Apply border radius
* @param {number} borderRadius - Border radius value
* @returns {string} Shell popup CSS
*/
getShellPopupStyle(popupColor, applyRadius, borderRadius) {
const cacheKey = `shell_popup_${popupColor}_${applyRadius}_${borderRadius}`;
if (this._templateCache.has(cacheKey)) {
return this._templateCache.get(cacheKey);
}
const radiusRule = applyRadius ? `border-radius: ${borderRadius}px;` : '';
const css = `
/* GNOME Shell Popup Menus */
.popup-menu-boxpointer,
.popup-menu-content,
.modal-dialog {
background-color: ${popupColor} !important;
${radiusRule}
}
`;
this._templateCache.set(cacheKey, css);
return css;
}
// ===== ZORIN ACCENT COLOR INTEGRATION =====
/**
* Generate Zorin accent color CSS
* @param {string} accentRgb - Accent color in rgb() format
* @param {boolean} isDark - Is dark theme
* @returns {string} Accent color CSS
*/
getZorinAccentStyle(accentRgb, isDark) {
const cacheKey = `zorin_accent_${accentRgb}_${isDark}`;
if (this._templateCache.has(cacheKey)) {
return this._templateCache.get(cacheKey);
}
// Enhanced pastel for dark themes
const displayColor = isDark ? this._enhancePastelForDark(accentRgb) : accentRgb;
const fgColor = isDark ? "#ffffff" : "#161c1f"; // Contrasting text color
const css = `
/* Zorin Theme Accent Color */
@define-color accent_color ${displayColor};
@define-color accent_bg_color ${displayColor};
/* Switch widget - track (container) */
switch:checked {
background-color: ${displayColor};
background-image: image(${displayColor});
border-color: ${displayColor};
}
/* Switch slider - contrasting color for visibility */
switch:checked > slider {
background-color: ${fgColor};
}
/* Checkboxes and Radio buttons - use accent color */
check:checked,
check:indeterminate,
radio:checked,
radio:indeterminate {
background-color: ${displayColor};
background-image: image(${displayColor});
border-color: ${displayColor};
color: ${fgColor};
box-shadow: none;
}
/* Note: Checkbox/Radio icons use theme's own assets (e.g., Fluent uses assets/scalable/*.svg)
* We do NOT override -gtk-icon-source here to preserve theme's icon styling
*/
/* Progress bars */
progressbar > trough > progress {
background-color: ${displayColor};
}
/* Selected items in lists */
row.activatable:selected,
.view:selected,
.view:selected:focus,
.view text:selected,
.view text:selected:focus,
textview text:selected,
textview text:selected:focus,
iconview:selected,
iconview:selected:focus,
flowbox > flowboxchild:selected,
.content-view .tile:selected {
background-color: ${displayColor};
color: ${fgColor};
}
/* Links hover state */
link:hover {
color: ${displayColor};
}
/* Spinbutton/Entry progress indicator */
spinbutton > progress > trough > progress,
entry > progress > trough > progress {
background-color: ${displayColor};
}
`;
this._templateCache.set(cacheKey, css);
return css;
}
// ===== GTK4 SPECIFIC OVERRIDES =====
/**
* Get GTK4-specific CSS overrides
* @param {number} borderRadius - Border radius value
* @returns {string} GTK4 override CSS
*/
getGtk4Overrides(borderRadius) {
const cacheKey = `gtk4_overrides_${borderRadius}`;
if (this._templateCache.has(cacheKey)) {
return this._templateCache.get(cacheKey);
}
const css = `
/* GTK4 Specific Overrides */
.card {
background: @cssgnomme_popup_bg;
border-radius: ${borderRadius}px;
}
popover.menu {
border-radius: ${borderRadius}px;
}
window {
border-radius: ${borderRadius}px;
}
window > box > box > box {
border-radius: ${borderRadius}px;
}
/* GTK4 window decorations */
windowhandle,
windowcontrols {
border-radius: ${borderRadius}px ${borderRadius}px 0 0;
}
headerbar {
border-radius: ${borderRadius}px ${borderRadius}px 0 0;
}
/* Fix ComboRow dropdown popup border (Adwaita preferences) */
.menu.background {
border: none;
box-shadow: none;
background: transparent;
}
.menu > arrow {
border: none;
background: transparent;
}
`;
this._templateCache.set(cacheKey, css);
return css;
}
// ===== SHADOW EFFECTS =====
/**
* Generate shadow effect CSS
* @param {string} shadowColor - Shadow color
* @param {number} strength - Shadow strength (0-1)
* @returns {string} Shadow CSS
*/
getShadowStyle(shadowColor, strength) {
const cacheKey = `shadow_${shadowColor}_${strength}`;
if (this._templateCache.has(cacheKey)) {
return this._templateCache.get(cacheKey);
}
const spread = Math.round(strength * Constants.SHADOW_SPREAD_MULTIPLIER);
const css = `
/* Shadow Effects */
.panel,
.popup-menu {
box-shadow: 0 2px ${spread}px ${shadowColor};
}
`;
this._templateCache.set(cacheKey, css);
return css;
}
// ===== UTILITY METHODS =====
/**
* Clear template cache (for cleanup)
*/
clearCache() {
this._templateCache.clear();
}
/**
* Get cache size for monitoring
* @returns {number} Number of cached templates
*/
getCacheSize() {
return this._templateCache.size;
}
/**
* Enhance pastel colors for dark themes
* @private
* @param {string} rgbColor - Color in rgb() format
* @returns {string} Enhanced color
*/
_enhancePastelForDark(rgbColor) {
// Parse rgb(r, g, b) format
const match = rgbColor.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
if (!match) return rgbColor;
const r = parseInt(match[1]);
const g = parseInt(match[2]);
const b = parseInt(match[3]);
// Use ThemeUtils if available, otherwise simple boost
try {
const ThemeUtils = Me.imports.themeUtils.ThemeUtils;
const enhanced = ThemeUtils.enhancePastelColor([r, g, b], 0.3, 0.25);
return `rgb(${enhanced[0]}, ${enhanced[1]}, ${enhanced[2]})`;
} catch (e) {
// Fallback: Simple saturation boost
const max = Math.max(r, g, b);
const min = Math.min(r, g, b);
const delta = max - min;
if (delta === 0) return rgbColor;
const boost = 1.3;
const newR = Math.min(255, Math.round(r + (r - min) * boost * 0.3));
const newG = Math.min(255, Math.round(g + (g - min) * boost * 0.3));
const newB = Math.min(255, Math.round(b + (b - min) * boost * 0.3));
return `rgb(${newR}, ${newG}, ${newB})`;
}
}
/**
* Generate complete CSS from multiple sections
* @param {Object} sections - Object with section names as keys and CSS strings as values
* @returns {string} Complete CSS document
*/
assembleCss(sections) {
const parts = [];
// Add header
parts.push(`/* CSSGnomme Dynamic Theme Overlay */\n/* Generated: ${new Date().toISOString()} */\n`);
// Add each section with separator
for (const [name, css] of Object.entries(sections)) {
if (css && css.trim()) {
parts.push(`\n/* ========== ${name.toUpperCase()} ========== */\n`);
parts.push(css);
}
}
return parts.join('\n');
}
// ===== GNOME SHELL COMPONENT CSS GENERATORS =====
/**
* Generate panel-specific CSS for GNOME Shell
* This is a large CSS template that defines panel, panel buttons, and Zorin Taskbar styling
*
* @param {Object} vars - Complete variables object from _extractShellCssVars
* @param {number} vars.borderRadius - Border radius in pixels
* @param {number} vars.borderWidth - Border width in pixels
* @param {boolean} vars.applyPanelRadius - Apply border radius to panel
* @param {boolean} vars.enableZorinIntegration - Enable Zorin-specific styling
* @param {boolean} vars.isZorinTheme - Is current theme a Zorin theme
* @param {boolean} vars.isLightTheme - Is light theme mode
* @param {string} vars.accentRgb - Accent color RGB (e.g., "59, 66, 82")
* @param {string} vars.borderColor - Border color (rgba format)
* @param {string} vars.hoverRgb - Hover state RGB
* @param {number} vars.hoverOpacity - Hover state opacity
* @param {number} vars.activeOpacity - Active state opacity
* @param {string} vars.panelBackgroundCss - Panel background CSS rule
* @param {string} vars.backdropFilter - Backdrop filter CSS rule
* @param {string} vars.shadowColor - Shadow color (rgba format)
* @param {number} vars.shadowPanelBlur - Panel shadow blur radius
* @param {number} vars.shadowButtonBlur - Button shadow blur radius
* @param {number} vars.shadowInsetBlur - Inset shadow blur radius
* @param {number} vars.blurRadius - Blur radius in pixels
* @param {number} vars.blurSaturate - Blur saturation multiplier
* @param {number} vars.blurContrast - Blur contrast multiplier
* @param {number} vars.blurBrightness - Blur brightness multiplier
* @param {string} vars.blurBackgroundOverlay - Blur background overlay color
* @returns {string} Panel CSS content
*/
getPanelCss(vars) {
const {
borderRadius,
borderWidth,
applyPanelRadius,
enableZorinIntegration,
isZorinTheme,
isLightTheme,
accentRgb,
borderColor,
hoverRgb,
hoverOpacity,
activeOpacity,
panelBackgroundCss,
backdropFilter,
shadowColor,
shadowPanelBlur,
shadowButtonBlur,
shadowInsetBlur,
blurRadius,
blurSaturate,
blurContrast,
blurBrightness,
blurBackgroundOverlay
} = vars;
return `
/* Panel - Using !important to override Zorin Taskbar inline styles */
#panel {
${panelBackgroundCss}
${
applyPanelRadius
? `border-radius: ${borderRadius}px !important;`
: "/* border-radius disabled by user preference */"
}
border: ${borderWidth}px solid ${borderColor} !important;
backdrop-filter: blur(${blurRadius}px) saturate(${blurSaturate}) contrast(${blurContrast}) brightness(${blurBrightness}) !important;
-webkit-backdrop-filter: blur(${blurRadius}px) saturate(${blurSaturate}) contrast(${blurContrast}) brightness(${blurBrightness}) !important;
box-shadow: ${borderWidth > 0 ? `0 3px ${shadowPanelBlur}px ${shadowColor}, inset 0 0 ${shadowInsetBlur}px ${blurBackgroundOverlay}` : `0 3px ${shadowPanelBlur}px ${shadowColor}`} !important;
}
#panel .panel-button {
border-radius: calc(${borderRadius}px * ${Constants.BORDER_RADIUS_SCALING.panelButton}) !important;
transition: all 150ms ease-in-out !important;
}
/* Panel button hover - subtle background color change */
#panel .panel-button:hover {
background-color: rgba(${hoverRgb}, ${hoverOpacity}) !important;
}
${
isZorinTheme
? `
/* Zorin Theme: Clock display fix - hide parent hover, apply to inner .clock element */
#panel .panel-button.clock-display {
border-radius: 0 !important;
}
#panel .panel-button.clock-display:hover {
background-color: transparent !important;
}
#panel .panel-button.clock-display .clock {
border-radius: calc(${borderRadius}px * ${Constants.BORDER_RADIUS_SCALING.panelButton}) !important;
transition: all 150ms ease-in-out !important;
}
#panel .panel-button.clock-display:hover .clock {
background-color: rgba(${hoverRgb}, ${hoverOpacity}) !important;
}
/* Clock active/focus/checked state - stronger highlight on inner .clock */
#panel .panel-button.clock-display:active .clock,
#panel .panel-button.clock-display:focus .clock,
#panel .panel-button.clock-display:checked .clock {
background-color: rgba(${hoverRgb}, ${activeOpacity}) !important;
}
/* Ensure parent stays transparent even when active/focus/checked */
#panel .panel-button.clock-display:active,
#panel .panel-button.clock-display:focus,
#panel .panel-button.clock-display:checked {
background-color: transparent !important;
}
`
: ""
}
/* Panel button active/checked - stronger background */
#panel .panel-button:active,
#panel .panel-button:focus,
#panel .panel-button:checked {
background-color: rgba(${hoverRgb}, ${activeOpacity}) !important;
}
${
isZorinTheme && isLightTheme
? `
/* Zorin Light Theme: Accent color for active/checked icons */
#panel .panel-button:active StIcon,
#panel .panel-button:focus StIcon,
#panel .panel-button:checked StIcon {
color: rgb(${accentRgb}) !important;
}
`
: ""
}
${
enableZorinIntegration
? `
/* Zorin Taskbar specific enhancements - only if integration enabled */
.zorintaskbarMainPanel {
${panelBackgroundCss}
${backdropFilter}
${
applyPanelRadius
? `border-radius: ${borderRadius}px !important;`
: "/* border-radius disabled by user preference */"
}
border: ${borderWidth}px solid ${borderColor} !important;
box-shadow: 0 2px ${shadowButtonBlur}px ${shadowColor} !important;
}
.zorintaskbarMainPanel .panel-button {
border-radius: calc(${borderRadius}px * ${Constants.BORDER_RADIUS_SCALING.panelButton}) !important;
transition: all 150ms ease-in-out !important;
}
/* Zorin Taskbar button hover - subtle background color change */
.zorintaskbarMainPanel .panel-button:hover {
background-color: rgba(${hoverRgb}, ${hoverOpacity}) !important;
}
${
isZorinTheme
? `
/* Zorin Theme: Clock display fix - hide parent hover, apply to inner .clock element */
.zorintaskbarMainPanel .panel-button.clock-display {
border-radius: 0 !important;
}
.zorintaskbarMainPanel .panel-button.clock-display:hover {
background-color: transparent !important;
}
.zorintaskbarMainPanel .panel-button.clock-display .clock {
border-radius: calc(${borderRadius}px * ${Constants.BORDER_RADIUS_SCALING.panelButton}) !important;
transition: all 150ms ease-in-out !important;
}
.zorintaskbarMainPanel .panel-button.clock-display:hover .clock {
background-color: rgba(${hoverRgb}, ${hoverOpacity}) !important;
}
/* Clock active/focus/checked state - stronger highlight on inner .clock */
.zorintaskbarMainPanel .panel-button.clock-display:active .clock,
.zorintaskbarMainPanel .panel-button.clock-display:focus .clock,
.zorintaskbarMainPanel .panel-button.clock-display:checked .clock {
background-color: rgba(${hoverRgb}, ${activeOpacity}) !important;
}
/* Ensure parent stays transparent even when active/focus/checked */
.zorintaskbarMainPanel .panel-button.clock-display:active,
.zorintaskbarMainPanel .panel-button.clock-display:focus,
.zorintaskbarMainPanel .panel-button.clock-display:checked {
background-color: transparent !important;
}
`
: ""
}
/* Zorin Taskbar button active/checked - stronger background */
.zorintaskbarMainPanel .panel-button:active,
.zorintaskbarMainPanel .panel-button:focus,
.zorintaskbarMainPanel .panel-button:checked {
background-color: rgba(${hoverRgb}, ${activeOpacity}) !important;
}
${
isZorinTheme && isLightTheme
? `
/* Zorin Light Theme: Accent color for active/checked icons in taskbar */
.zorintaskbarMainPanel .panel-button:active StIcon,
.zorintaskbarMainPanel .panel-button:focus StIcon,
.zorintaskbarMainPanel .panel-button:checked StIcon {
color: rgb(${accentRgb}) !important;
}
`
: ""
}
`
: ""
}`;
}
/**
* Generate popup/menu-specific CSS for GNOME Shell
* This is a large CSS template that defines popup menus, quick settings, dash, notifications, OSD, app switcher
*
* @param {Object} vars - Complete variables object from _extractShellCssVars
* @param {number} vars.borderRadius - Border radius in pixels
* @param {number} vars.borderWidth - Border width in pixels
* @param {boolean} vars.enableZorinIntegration - Enable Zorin-specific styling
* @param {boolean} vars.isZorinTheme - Is current theme a Zorin theme
* @param {string} vars.accentRgb - Accent color RGB
* @param {string} vars.borderColor - Border color (rgba format)
* @param {string} vars.blurBackgroundOverlay - Blur background overlay color
* @param {string} vars.backdropFilter - Backdrop filter CSS rule
* @param {string} vars.popupBackgroundCss - Popup background CSS rule
* @param {string} vars.previewBackgroundCss - Preview background CSS rule
* @param {string} vars.shadowColor - Shadow color (rgba format)
* @param {number} vars.shadowPopupBlur - Popup shadow blur radius
* @param {number} vars.shadowInsetBlur - Inset shadow blur radius
* @param {boolean} vars.applyPanelRadius - Apply border radius (used for dash)
* @returns {string} Popup/menu CSS content
*/
getPopupCss(vars) {
const {
borderRadius,
borderWidth,
enableZorinIntegration,
isZorinTheme,
accentRgb,
borderColor,
blurBackgroundOverlay,
backdropFilter,
popupBackgroundCss,
previewBackgroundCss,
shadowColor,
shadowPopupBlur,
shadowInsetBlur
} = vars;
// Generate theme-aware shadow with conditional inset glow (glossy look only with border)
const simpleShadow = vars.borderWidth > 0
? `box-shadow: 0 2px ${shadowPopupBlur}px ${shadowColor}, inset 0 0 ${shadowInsetBlur}px ${blurBackgroundOverlay} !important;`
: `box-shadow: 0 2px ${shadowPopupBlur}px ${shadowColor} !important;`;
return `
/* Popup Menus - outer wrapper (transparent, no visual styling) */
.popup-menu,
.app-menu,
.panel-menu {
background: none !important;
border: none !important;
box-shadow: none !important;
padding: 0 !important;
margin: 0 !important;
}
/* Quick Settings - wrapper only (no border here) - FORCE OVERRIDE */
.quick-settings.quick-settings,
.quick-settings-menu.quick-settings-menu,
#panel .quick-settings,
#panel .quick-settings-menu {
background: none !important;
border: none !important;
box-shadow: none !important;
padding: 0 !important;
margin: 0 !important;
border-radius: 0 !important;
}
/* Reset any pseudo-elements that might create ghost borders */
.popup-menu::before,
.popup-menu::after,
.quick-settings::before,
.quick-settings::after,
.quick-settings-menu::before,
.quick-settings-menu::after {
display: none !important;
}
/* Popup menu content - actual visible container with border */
.popup-menu-content,
.popup-menu-box {
${popupBackgroundCss}
border-radius: ${borderRadius}px !important;
border: ${borderWidth}px solid ${borderColor} !important;
${simpleShadow}
${backdropFilter}
padding: ${Constants.UI_PADDING.previewHeader.vertical}px !important;
margin: 0 !important;
box-sizing: border-box !important;
}
/* Quick Settings grid - visible container with border */
.quick-settings-grid {
${popupBackgroundCss}
border-radius: ${borderRadius}px !important;
border: ${borderWidth}px solid ${borderColor} !important;
${simpleShadow}
${backdropFilter}
padding: ${Constants.UI_PADDING.previewHeader.horizontal}px !important;
margin: 0 !important;
box-sizing: border-box !important;
}
.popup-menu-item {
border-radius: calc(${borderRadius}px * ${Constants.BORDER_RADIUS_SCALING.popupItem}) !important;
padding: 8px 12px !important;
box-sizing: border-box !important;
}
${
!isZorinTheme && enableZorinIntegration
? `
/* Fluent Theme Enhancement: Zorin-style menu improvements when integration enabled */
/* Visible separator line for better menu organization */
.popup-separator-menu-item {
margin: 3px 0 !important;
padding: 0 !important;
}
.popup-separator-menu-item .popup-separator-menu-item-separator {
height: 1px !important;
background-color: rgba(${accentRgb}, 0.2) !important;
margin: 0 4px !important;
}
/* Enhanced menu item spacing and padding (Zorin-style) */
.popup-menu-item {
padding: 7.5px 12px !important;
border-radius: 8px !important;
transition-duration: 150ms !important;
}
.popup-menu-item:ltr {
padding-left: 8px !important;
}
.popup-menu-item:rtl {
padding-right: 8px !important;
}
/* Sub-menu separators with proper margins */
.popup-sub-menu .popup-separator-menu-item {
background-color: transparent !important;
}
.popup-sub-menu .popup-separator-menu-item:ltr {
margin-right: 2.5em !important;
}
.popup-sub-menu .popup-separator-menu-item:rtl {
margin-left: 2.5em !important;
}
.popup-sub-menu .popup-separator-menu-item .popup-separator-menu-item-separator {
background-color: rgba(${accentRgb}, ${Constants.ACCENT_HOVER_OPACITY.subtle}) !important;
}
`
: ""
}
/* Overview - clean with accent border */
.overview-controls {
border-radius: ${borderRadius}px;
}
/* Dash - strong accent border */
#dash {
${popupBackgroundCss}
${
vars.applyPanelRadius
? `border-radius: ${borderRadius}px !important;`
: "/* border-radius disabled by user preference */"
}
border: ${borderWidth}px solid rgba(${accentRgb}, 1.0) !important;
box-shadow: 0 4px ${shadowPopupBlur}px ${shadowColor} !important;
padding: 0 !important;
margin: 0 !important;
box-sizing: border-box !important;
outline: none !important;
}
/* Reset dash pseudo-elements */
#dash::before,
#dash::after {
display: none !important;
}
/* Dash content with padding */
#dash > * {
padding: 8px;
}
/* Message Tray / Notifications - use popup background and transparency */
.message-list-section,
.message {
${popupBackgroundCss}
border-radius: ${borderRadius}px !important;
border: ${borderWidth}px solid ${borderColor} !important;
${simpleShadow}
${backdropFilter}
padding: 12px !important;
box-sizing: border-box !important;
}
/* OSD (Volume, Brightness popups) - strong accent */
.osd-window {
border-radius: ${borderRadius}px !important;
border: ${borderWidth}px solid rgba(${accentRgb}, 1.0) !important;
${simpleShadow}
${backdropFilter}
padding: 16px !important;
box-sizing: border-box !important;
outline: none !important;
}
/* Running App Indicators - use accent color */
.app-well-app-running-dot {
background-color: rgba(255, 255, 255, 0.5) !important;
}
StWidget.focused .app-well-app-running-dot${
enableZorinIntegration
? `,
#zorintaskbarScrollview StWidget.focused .app-well-app-running-dot`
: ""
} {
background-color: ${borderColor} !important;
}
${
enableZorinIntegration
? `
/* Zorin Taskbar - Enhanced hover for app buttons (favorites and active apps) */
#zorintaskbarScrollview .app-well-app:hover .overview-icon {
background-color: rgba(${accentRgb}, 0.3) !important;
transition: background-color 150ms ease-out !important;
}
#zorintaskbarScrollview .app-well-app:active .overview-icon {
background-color: rgba(${accentRgb}, ${Constants.ACCENT_HOVER_OPACITY.active}) !important;
}
/* Zorin Menu - Add right padding to categories to prevent collision with slider */
.shortcuts-box {
padding-right: 8px !important;
}
.popup-menu-item.category-menu-item {
padding-right: 8px !important;
}
.vertical-separator {
margin-right: 8px !important;
}
`
: ""
}
/* GTK4/Adwaita - Fix ComboRow popup styling (preferences dropdown) */
.menu.background {
border: none !important;
box-shadow: none !important;
background: none !important;
}
/* App Switcher (Alt+Tab) - Complete Styling */
.switcher-popup {
padding: 0 !important;
spacing: 24px !important;
}
.switcher-list {
${popupBackgroundCss}
border-radius: ${borderRadius}px !important;
border: ${borderWidth}px solid ${borderColor} !important;
${simpleShadow}
${backdropFilter}
padding: 10px !important;
box-sizing: border-box !important;
}
.switcher-list .switcher-list-item-container {
spacing: 12px !important;
}
/* App Switcher item boxes - base state */
.switcher-list .item-box {
background-color: transparent !important;
border-radius: calc(${borderRadius}px * 0.75) !important;
padding: 6px !important;
spacing: 6px !important;
border: 2px solid transparent !important;
transition-duration: 150ms !important;
text-align: center !important;
}
/* App Switcher item hover */
.switcher-list .item-box:hover {
background-color: rgba(${accentRgb}, ${Constants.ACCENT_HOVER_OPACITY.subtle}) !important;
}
/* App Switcher item selected/focused - use accent color */
.switcher-list .item-box:selected,
.switcher-list .item-box:focus {
background-color: rgba(${accentRgb}, ${Constants.ACCENT_HOVER_OPACITY.medium}) !important;
border-color: ${borderColor} !important;
}
.switcher-list .item-box:selected:hover,
.switcher-list .item-box:focus:hover {
background-color: rgba(${accentRgb}, ${Constants.ACCENT_HOVER_OPACITY.strong}) !important;
}