aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-05-10 15:40:51 +0200
committerJoas Schilling <coding@schilljs.com>2023-05-10 15:41:32 +0200
commitb70b1f66c979dca64bf0d1563b0b4ad676633cfb (patch)
tree3c6353d9c68dd93eaac593f8eeead3268b2537b6
parent4822f104f70f1ee23293f7eff227bb44c7493595 (diff)
downloadnextcloud-server-b70b1f66c979dca64bf0d1563b0b4ad676633cfb.tar.gz
nextcloud-server-b70b1f66c979dca64bf0d1563b0b4ad676633cfb.zip
fix(theming): Cut of the brightness into both directions if unknown
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--apps/theming/lib/Util.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/theming/lib/Util.php b/apps/theming/lib/Util.php
index f5321dada67..41ded251b0b 100644
--- a/apps/theming/lib/Util.php
+++ b/apps/theming/lib/Util.php
@@ -78,18 +78,18 @@ class Util {
* get color for on-page elements:
* theme color by default, grey if theme color is to bright
* @param string $color
- * @param bool $brightBackground
+ * @param ?bool $brightBackground
* @return string
*/
- public function elementColor($color, bool $brightBackground = true) {
+ public function elementColor($color, ?bool $brightBackground = null) {
$luminance = $this->calculateLuminance($color);
- if ($brightBackground && $luminance > 0.8) {
+ if ($brightBackground !== false && $luminance > 0.8) {
// If the color is too bright in bright mode, we fall back to a darker gray
return '#aaaaaa';
}
- if (!$brightBackground && $luminance < 0.2) {
+ if ($brightBackground !== true && $luminance < 0.2) {
// If the color is too dark in dark mode, we fall back to a brighter gray
return '#8c8c8c';
}