Skip to content

Commit

Permalink
Merge pull request #45430 from nextcloud/fix/stable-background-color
Browse files Browse the repository at this point in the history
[stable29] Fix header menu icon color
  • Loading branch information
susnux authored May 28, 2024
2 parents 04790e9 + fc113c8 commit 2a61d2b
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions apps/theming/css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions apps/theming/lib/Themes/CommonThemeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ protected function generateGlobalBackgroundVariables(): array {
$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) {
Expand Down Expand Up @@ -143,6 +144,7 @@ protected function generateUserBackgroundVariables(): array {
'--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',
];
}

Expand All @@ -161,6 +163,7 @@ protected function generateUserBackgroundVariables(): array {
// --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',
];
}

Expand All @@ -170,6 +173,7 @@ protected function generateUserBackgroundVariables(): array {
'--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',
];
}
}
Expand Down
1 change: 1 addition & 0 deletions apps/theming/lib/Themes/DefaultTheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public function getCSSVariables(): array {
'--background-invert-if-dark' => 'no',
'--background-invert-if-bright' => 'invert(100%)',
'--background-image-invert-if-bright' => 'no',
'--background-image-color-text' => '#ffffff',
];

// Primary variables
Expand Down
2 changes: 1 addition & 1 deletion core/css/header.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/css/header.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions core/css/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
#header {
/* Header menu */
$header-menu-entry-height: 44px;
--color-primary-text: var(--background-image-color-text, #ffffff);

.header-right > div > .menu {
background-color: var(--color-main-background);
Expand Down
2 changes: 1 addition & 1 deletion core/css/server.css

Large diffs are not rendered by default.

Loading

0 comments on commit 2a61d2b

Please sign in to comment.