From 4b46c5a5a02b6c1c77b99cf21b9ff933fabbcc35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Wed, 5 Oct 2022 11:34:05 +0200 Subject: Use default system primary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- apps/theming/lib/Themes/CommonThemeTrait.php | 1 + apps/theming/lib/Themes/DefaultTheme.php | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'apps/theming/lib/Themes') diff --git a/apps/theming/lib/Themes/CommonThemeTrait.php b/apps/theming/lib/Themes/CommonThemeTrait.php index 631879ea832..d88a6a319fb 100644 --- a/apps/theming/lib/Themes/CommonThemeTrait.php +++ b/apps/theming/lib/Themes/CommonThemeTrait.php @@ -42,6 +42,7 @@ trait CommonThemeTrait { // primary related colours return [ '--color-primary' => $this->primaryColor, + '--color-primary-default' => $this->defaultPrimaryColor, '--color-primary-text' => $this->util->invertTextColor($this->primaryColor) ? '#000000' : '#ffffff', '--color-primary-hover' => $this->util->mix($this->primaryColor, $colorMainBackground, 60), '--color-primary-light' => $colorPrimaryLight, diff --git a/apps/theming/lib/Themes/DefaultTheme.php b/apps/theming/lib/Themes/DefaultTheme.php index e295d5d880a..b6c84e82d7b 100644 --- a/apps/theming/lib/Themes/DefaultTheme.php +++ b/apps/theming/lib/Themes/DefaultTheme.php @@ -48,6 +48,7 @@ class DefaultTheme implements ITheme { public IConfig $config; public IL10N $l; + public string $defaultPrimaryColor; public string $primaryColor; public function __construct(Util $util, @@ -65,9 +66,12 @@ class DefaultTheme implements ITheme { $this->config = $config; $this->l = $l; - $initialPrimaryColor = $this->themingDefaults->getColorPrimary(); - // Override default color if set to improve accessibility - $this->primaryColor = $initialPrimaryColor === BackgroundService::DEFAULT_COLOR ? BackgroundService::DEFAULT_ACCESSIBLE_COLOR : $initialPrimaryColor; + $this->defaultPrimaryColor = $this->themingDefaults->getDefaultColorPrimary(); + + // Override default codefaultPrimaryColorlor if set to improve accessibility + $this->primaryColor = $this->defaultPrimaryColor === BackgroundService::DEFAULT_COLOR + ? BackgroundService::DEFAULT_ACCESSIBLE_COLOR + : $this->themingDefaults->getColorPrimary(); } public function getId(): string { -- cgit v1.2.3 From 9a92fe9b29fb0db0486cebdc869627e0ac3bd4ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= Date: Thu, 6 Oct 2022 12:36:59 +0200 Subject: Fix primary and debounce to avoid infinite loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- apps/theming/lib/Themes/DefaultTheme.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'apps/theming/lib/Themes') diff --git a/apps/theming/lib/Themes/DefaultTheme.php b/apps/theming/lib/Themes/DefaultTheme.php index b6c84e82d7b..4dce1dca809 100644 --- a/apps/theming/lib/Themes/DefaultTheme.php +++ b/apps/theming/lib/Themes/DefaultTheme.php @@ -67,11 +67,12 @@ class DefaultTheme implements ITheme { $this->l = $l; $this->defaultPrimaryColor = $this->themingDefaults->getDefaultColorPrimary(); + $this->primaryColor = $this->themingDefaults->getColorPrimary(); - // Override default codefaultPrimaryColorlor if set to improve accessibility - $this->primaryColor = $this->defaultPrimaryColor === BackgroundService::DEFAULT_COLOR - ? BackgroundService::DEFAULT_ACCESSIBLE_COLOR - : $this->themingDefaults->getColorPrimary(); + // Override default defaultPrimaryColor if set to improve accessibility + if ($this->primaryColor === BackgroundService::DEFAULT_COLOR) { + $this->primaryColor = BackgroundService::DEFAULT_ACCESSIBLE_COLOR; + } } public function getId(): string { -- cgit v1.2.3