diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2023-12-15 16:14:37 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2023-12-15 21:09:39 +0100 |
commit | 84123b3910cd926da4162ce0a0b4838516d63241 (patch) | |
tree | 8c602da2ce45194b2c65597bf520f2e4a284fcbf /apps/theming/lib | |
parent | 61f401da57d6d883dbee2b236f7c2f77e7fa9612 (diff) | |
download | nextcloud-server-84123b3910cd926da4162ce0a0b4838516d63241.tar.gz nextcloud-server-84123b3910cd926da4162ce0a0b4838516d63241.zip |
fix(theming): Adjust primary text color calculation to also work with high contrast themes
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/theming/lib')
-rw-r--r-- | apps/theming/lib/Themes/CommonThemeTrait.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/apps/theming/lib/Themes/CommonThemeTrait.php b/apps/theming/lib/Themes/CommonThemeTrait.php index 38ca760db9f..85172f1e9bc 100644 --- a/apps/theming/lib/Themes/CommonThemeTrait.php +++ b/apps/theming/lib/Themes/CommonThemeTrait.php @@ -43,6 +43,7 @@ trait CommonThemeTrait { $colorPrimaryElement = $this->util->elementColor($this->primaryColor, $isBrightColor, $colorMainBackground); $colorPrimaryLight = $this->util->mix($colorPrimaryElement, $colorMainBackground, -80); $colorPrimaryElementLight = $this->util->mix($colorPrimaryElement, $colorMainBackground, -80); + $invertPrimaryTextColor = $this->util->invertTextColor($colorPrimaryElement); // primary related colours return [ @@ -66,10 +67,10 @@ trait CommonThemeTrait { // used for buttons, inputs... '--color-primary-element' => $colorPrimaryElement, - '--color-primary-element-hover' => $this->util->mix($colorPrimaryElement, $colorMainBackground, 87), - '--color-primary-element-text' => $this->util->invertTextColor($colorPrimaryElement) ? '#000000' : '#ffffff', + '--color-primary-element-hover' => $invertPrimaryTextColor ? $this->util->lighten($colorPrimaryElement, 4) : $this->util->darken($colorPrimaryElement, 4), + '--color-primary-element-text' => $invertPrimaryTextColor ? '#000000' : '#ffffff', // mostly used for disabled states - '--color-primary-element-text-dark' => $this->util->darken($this->util->invertTextColor($colorPrimaryElement) ? '#000000' : '#ffffff', 6), + '--color-primary-element-text-dark' => $invertPrimaryTextColor ? $this->util->lighten('#000000', 4) : $this->util->darken('#ffffff', 4), // used for hover/focus states '--color-primary-element-light' => $colorPrimaryElementLight, |