Refactor element separation handling in ZenThemeModifier and update references in ZenCompactMode and ZenViewSplitter

This commit is contained in:
mr. m
2025-04-09 14:04:24 +02:00
parent b31e712d2c
commit 509cb2471d
3 changed files with 14 additions and 15 deletions

View File

@@ -11,6 +11,7 @@
*/
const kZenThemePrefsList = ['zen.theme.accent-color', 'zen.theme.border-radius', 'zen.theme.content-element-separation'];
const kZenMaxElementSeparation = 12;
/**
* ZenThemeModifier controls the application of theme data to the browser,
@@ -68,7 +69,7 @@ var ZenThemeModifier = {
},
updateElementSeparation() {
const separation = Services.prefs.getIntPref('zen.theme.content-element-separation');
let separation = this.elementSeparation;
document.documentElement.style.setProperty('--zen-element-separation', separation + 'px');
if (separation == 0) {
document.documentElement.setAttribute('zen-no-padding', true);
@@ -77,6 +78,10 @@ var ZenThemeModifier = {
}
},
get elementSeparation() {
return Math.min(Services.prefs.getIntPref('zen.theme.content-element-separation'), kZenMaxElementSeparation);
},
/**
* Update the accent color.
*/