Skip to content

Commit f456994

Browse files
committed
feat: Improved color blending for transparent systems, b=no-bug, c=common, workspaces
1 parent 9988994 commit f456994

File tree

4 files changed

+26
-13
lines changed

4 files changed

+26
-13
lines changed

src/zen/common/styles/zen-popup.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,13 @@
4040
menupopup,
4141
panel {
4242
--panel-background: var(--arrowpanel-background);
43-
--panel-border-radius: var(--zen-native-inner-radius);
4443
--menuitem-padding: 6px !important;
44+
--panel-shadow-margin: 10px;
45+
46+
/* This should match GetMenuMaskImage() on macOS, or be overridden below */
47+
@media (-moz-platform: macos) {
48+
--panel-border-radius: 10px;
49+
}
4550
}
4651

4752
/* split-view popup */

src/zen/common/styles/zen-theme.css

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,6 @@
228228
@media (-moz-windows-mica) or (-moz-platform: macos) or ((-moz-platform: linux) and -moz-pref('zen.widget.linux.transparency')) {
229229
background: transparent;
230230
--zen-themed-toolbar-bg-transparent: transparent;
231-
@media -moz-pref('widget.windows.mica.toplevel-backdrop', 2) {
232-
--zen-themed-toolbar-bg-transparent: light-dark(
233-
rgba(0, 0, 0, 0.2),
234-
rgba(255, 255, 255, 0.35)
235-
);
236-
}
237-
@media (-moz-platform: macos) {
238-
--zen-themed-toolbar-bg-transparent: rgba(255, 255, 255, 0.3);
239-
}
240231
}
241232

242233
&[zen-should-be-dark-mode='true'] #browser {

src/zen/workspaces/ZenGradientGenerator.mjs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,23 @@
10481048
}
10491049

10501050
blendWithWhiteOverlay(baseColor, opacity) {
1051+
let colorToBlend;
1052+
let colorToBlendOpacity;
1053+
if (this.isMica) {
1054+
colorToBlend = !this.isDarkMode ? [0, 0, 0] : [255, 255, 255];
1055+
colorToBlendOpacity = !this.isDarkMode ? 0.2 : 0.3;
1056+
} else if (AppConstants.platform === 'macosx') {
1057+
colorToBlend = [255, 255, 255];
1058+
colorToBlendOpacity = 0.3;
1059+
}
1060+
if (colorToBlend) {
1061+
const blendedAlpha = Math.min(
1062+
1,
1063+
opacity + MIN_OPACITY + colorToBlendOpacity * (1 - (opacity + MIN_OPACITY))
1064+
);
1065+
baseColor = this.blendColors(baseColor, colorToBlend, blendedAlpha * 100);
1066+
opacity += colorToBlendOpacity * (1 - opacity);
1067+
}
10511068
return `rgba(${baseColor[0]}, ${baseColor[1]}, ${baseColor[2]}, ${opacity})`;
10521069
}
10531070

@@ -1110,7 +1127,7 @@
11101127
return forToolbar
11111128
? this.getToolbarModifiedBase()
11121129
: this.isDarkMode
1113-
? 'rgba(0, 0, 0, 0.45)'
1130+
? 'rgba(0, 0, 0, 0.25)'
11141131
: 'transparent';
11151132
} else if (themedColors.length === 1) {
11161133
return this.getSingleRGBColor(themedColors[0], forToolbar);

src/zen/workspaces/zen-gradient-generator.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,15 @@
235235
.zen-theme-picker-gradient {
236236
position: relative;
237237
overflow: hidden;
238-
border-radius: calc(var(--zen-native-content-radius) - 4px);
238+
border-radius: calc(var(--arrowpanel-border-radius) - 4px);
239239

240240
min-height: calc(var(--panel-width) - var(--panel-padding) * 2 - 2px);
241241
background: light-dark(rgba(0, 0, 0, 0.05), rgba(255, 255, 255, 0.03));
242242
background-image: radial-gradient(
243243
light-dark(rgba(0, 0, 0, 0.2), rgba(255, 255, 255, 0.1)) 1px,
244244
transparent 0
245245
);
246-
background-position: -20px -20px;
246+
background-position: -23px -23px;
247247
background-size: 6px 6px;
248248

249249
& .zen-theme-picker-dot {

0 commit comments

Comments
 (0)