diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-05-21 22:08:06 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-05-28 16:49:02 +0200 |
commit | 7dcc2e541c867c8558d270b2294f0df0c64ed8be (patch) | |
tree | 81aaf489a4b2df9912b955538a95df047c946ae1 /apps/theming | |
parent | 04790e9ae4bbd855382fc6102730886e73ae87f6 (diff) | |
download | nextcloud-server-7dcc2e541c867c8558d270b2294f0df0c64ed8be.tar.gz nextcloud-server-7dcc2e541c867c8558d270b2294f0df0c64ed8be.zip |
fix(theming): When selected a background image make header color independent of primary color
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/theming')
-rw-r--r-- | apps/theming/css/default.css | 1 | ||||
-rw-r--r-- | apps/theming/lib/Themes/CommonThemeTrait.php | 4 | ||||
-rw-r--r-- | apps/theming/lib/Themes/DefaultTheme.php | 1 |
3 files changed, 6 insertions, 0 deletions
diff --git a/apps/theming/css/default.css b/apps/theming/css/default.css index 201ec242912..5ed4b5b2739 100644 --- a/apps/theming/css/default.css +++ b/apps/theming/css/default.css @@ -68,6 +68,7 @@ --background-invert-if-dark: no; --background-invert-if-bright: invert(100%); --background-image-invert-if-bright: no; + --background-image-color-text: #ffffff; --primary-invert-if-bright: no; --primary-invert-if-dark: invert(100%); --color-primary: #00679e; diff --git a/apps/theming/lib/Themes/CommonThemeTrait.php b/apps/theming/lib/Themes/CommonThemeTrait.php index dd5b25e1a29..e55448758ca 100644 --- a/apps/theming/lib/Themes/CommonThemeTrait.php +++ b/apps/theming/lib/Themes/CommonThemeTrait.php @@ -113,6 +113,7 @@ trait CommonThemeTrait { $variables['--image-background'] = 'no'; // If no background image is set, we need to check against the shown primary colour $variables['--background-image-invert-if-bright'] = $isPrimaryBright ? 'invert(100%)' : 'no'; + $variables['--background-image-color-text'] = $isPrimaryBright ? '#000000' : '#ffffff'; } if ($hasCustomLogoHeader) { @@ -143,6 +144,7 @@ trait CommonThemeTrait { '--color-background-plain' => $this->primaryColor, // If no background image is set, we need to check against the shown primary colour '--background-image-invert-if-bright' => $isPrimaryBright ? 'invert(100%)' : 'no', + '--background-image-color-text' => $isPrimaryBright ? '#000000' : '#ffffff', ]; } @@ -161,6 +163,7 @@ trait CommonThemeTrait { // --image-background is not defined in this case '--color-background-plain' => $this->primaryColor, '--background-image-invert-if-bright' => $isPrimaryBright ? 'invert(100%)' : 'no', + '--background-image-color-text' => $isPrimaryBright ? '#000000' : '#ffffff', ]; } @@ -170,6 +173,7 @@ trait CommonThemeTrait { '--image-background' => "url('" . $this->urlGenerator->linkTo(Application::APP_ID, "img/background/$backgroundImage") . "')", '--color-background-plain' => $this->primaryColor, '--background-image-invert-if-bright' => BackgroundService::SHIPPED_BACKGROUNDS[$backgroundImage]['theming'] ?? null === BackgroundService::THEMING_MODE_DARK ? 'invert(100%)' : 'no', + '--background-image-color-text' => BackgroundService::SHIPPED_BACKGROUNDS[$backgroundImage]['theming'] ?? null === BackgroundService::THEMING_MODE_DARK ? '#000000' : '#ffffff', ]; } } diff --git a/apps/theming/lib/Themes/DefaultTheme.php b/apps/theming/lib/Themes/DefaultTheme.php index 68038f053e3..38b76d158b4 100644 --- a/apps/theming/lib/Themes/DefaultTheme.php +++ b/apps/theming/lib/Themes/DefaultTheme.php @@ -211,6 +211,7 @@ class DefaultTheme implements ITheme { '--background-invert-if-dark' => 'no', '--background-invert-if-bright' => 'invert(100%)', '--background-image-invert-if-bright' => 'no', + '--background-image-color-text' => '#ffffff', ]; // Primary variables |