diff --git a/apps/theming/lib/IconBuilder.php b/apps/theming/lib/IconBuilder.php index fb6909089b569..c9f7ee77b8683 100644 --- a/apps/theming/lib/IconBuilder.php +++ b/apps/theming/lib/IconBuilder.php @@ -234,7 +234,13 @@ public function colorSvg($app, $image) { } $svg = file_get_contents($imageFile); if ($svg !== false && $svg !== "") { - $color = $this->util->elementColor($this->themingDefaults->getColorPrimary()); + $primaryColor = $this->themingDefaults->getColorPrimary(); + $luminance = $this->util->calculateLuminance($primaryColor); + $isBrightColor = false; + if ($luminance > 0.8) { + $isBrightColor = true; + } + $color = $this->util->elementColor($primaryColor, $isBrightColor); $svg = $this->util->colorizeSvg($svg, $color); return $svg; } else { diff --git a/apps/theming/lib/Util.php b/apps/theming/lib/Util.php index f5321dada67dc..115fb9fd07283 100644 --- a/apps/theming/lib/Util.php +++ b/apps/theming/lib/Util.php @@ -86,12 +86,12 @@ public function elementColor($color, bool $brightBackground = true) { if ($brightBackground && $luminance > 0.8) { // If the color is too bright in bright mode, we fall back to a darker gray - return '#aaaaaa'; + return $this->darken($color, 20); } if (!$brightBackground && $luminance < 0.2) { // If the color is too dark in dark mode, we fall back to a brighter gray - return '#8c8c8c'; + return $this->lighten($color, 20); } return $color;