From 1e59e5d71218a49afdc980b003c1f00bbb9a74aa Mon Sep 17 00:00:00 2001 From: "Mr. M" Date: Tue, 19 Aug 2025 01:38:15 +0200 Subject: [PATCH] fix: Fixed color scheme generation for linux, b=no-bug, c=folders, workspaces --- src/zen/folders/zen-folders.css | 2 +- src/zen/workspaces/ZenGradientGenerator.mjs | 6 +++--- src/zen/workspaces/ZenWorkspace.mjs | 7 ++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/zen/folders/zen-folders.css b/src/zen/folders/zen-folders.css index e30918ca2..4031e1237 100644 --- a/src/zen/folders/zen-folders.css +++ b/src/zen/folders/zen-folders.css @@ -182,7 +182,7 @@ zen-folder { flex-direction: column; --zen-folder-behind-bgcolor: light-dark( color-mix(in srgb, var(--zen-primary-color) 85%, white), - color-mix(in srgb, var(--zen-primary-color) 75%, black) + color-mix(in srgb, var(--zen-primary-color) 60%, #c1c1c1) ); --zen-folder-front-bgcolor: light-dark( color-mix(in srgb, var(--zen-primary-color), white 70%), diff --git a/src/zen/workspaces/ZenGradientGenerator.mjs b/src/zen/workspaces/ZenGradientGenerator.mjs index 230a2dbb8..ba87edfaf 100644 --- a/src/zen/workspaces/ZenGradientGenerator.mjs +++ b/src/zen/workspaces/ZenGradientGenerator.mjs @@ -1504,7 +1504,7 @@ const rgb = this.hexToRgb(accentColor); if (this.isDarkMode) { // If the theme is dark, we want to use a lighter color - return this.blendColors(rgb, [0, 0, 0], 60); + return this.blendColors(rgb, [0, 0, 0], 40); } return rgb; } @@ -1648,8 +1648,6 @@ this.currentOpacity = theme.opacity ?? 0.5; this.#currentLightness = theme.lightness ?? 50; const gradient = this.getGradient(theme.gradientColors); - this.currentOpacity = previousOpacity; - this.#currentLightness = previousLightness; let dominantColor = this.getMostDominantColor(theme.gradientColors); const isDefaultTheme = !dominantColor; if (isDefaultTheme) { @@ -1670,6 +1668,8 @@ toolbarColor: this.getToolbarColor(isDarkMode), primaryColor: this.getAccentColorForUI(dominantColor), }; + this.currentOpacity = previousOpacity; + this.#currentLightness = previousLightness; return this.#gradientsCache[uuid]; } } diff --git a/src/zen/workspaces/ZenWorkspace.mjs b/src/zen/workspaces/ZenWorkspace.mjs index fcf7f13e9..c162eddd4 100644 --- a/src/zen/workspaces/ZenWorkspace.mjs +++ b/src/zen/workspaces/ZenWorkspace.mjs @@ -144,7 +144,8 @@ this.#updateOverflow(); - window.addEventListener('ZenGradientCacheChanged', this.#onGradientCacheChanged.bind(this)); + this.onGradientCacheChanged = this.#onGradientCacheChanged.bind(this); + window.addEventListener('ZenGradientCacheChanged', this.onGradientCacheChanged); this.dispatchEvent( new CustomEvent('ZenWorkspaceAttached', { @@ -155,6 +156,10 @@ ); } + disconnectedCallback() { + window.removeEventListener('ZenGradientCacheChanged', this.onGradientCacheChanged); + } + get active() { return this.hasAttribute('active'); }