Refactor ZenGradientGenerator.mjs to adjust color handling based on dark mode and improve workspace integration

This commit is contained in:
mr. M 2024-10-29 23:42:04 +01:00
parent 8ecd316c18
commit 99003f3cb5
No known key found for this signature in database
GPG key ID: CBD57A2AEDBDA1FB

View file

@ -439,7 +439,7 @@
}
}
const result = this.pSBC(
this.isDarkMode ? 0.7 : -0.7,
this.isDarkMode ? 0.5 : -0.5,
`rgb(${dominantColor[0]}, ${dominantColor[1]}, ${dominantColor[2]})`);
return result?.match(/\d+/g).map(Number);
}
@ -478,13 +478,14 @@
browser.gZenThemePicker.resetCustomColorList();
if (!workspaceTheme || workspaceTheme.type !== 'gradient') {
browser.document.body.style.removeProperty('--zen-main-browser-background');
browser.document.documentElement.style.removeProperty('--zen-main-browser-background');
browser.gZenThemePicker.updateNoise(0);
if (!skipUpdate) {
for (const dot of browser.gZenThemePicker.panel.querySelectorAll('.zen-theme-picker-dot')) {
dot.remove();
}
}
browser.document.documentElement.style.setProperty('--zen-primary-color', this.getNativeAccentColor());
return;
}
@ -520,6 +521,10 @@
});
}
getNativeAccentColor() {
return Services.prefs.getStringPref('zen.theme.accent-color');
}
resetCustomColorList() {
this.customColorList.innerHTML = '';
}