Skip to content

Commit b9ef482

Browse files
committed
try to fix too dark or bright themed icons
Signed-off-by: Simon L <[email protected]>
1 parent fc07627 commit b9ef482

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

apps/theming/lib/IconBuilder.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,14 @@ public function colorSvg($app, $image) {
234234
}
235235
$svg = file_get_contents($imageFile);
236236
if ($svg !== false && $svg !== "") {
237-
$color = $this->util->elementColor($this->themingDefaults->getColorPrimary());
237+
$primaryColor = $this->themingDefaults->getColorPrimary();
238+
$luminance = $this->util->calculateLuminance($primaryColor);
239+
if ($luminance > 0.8) {
240+
$isBrightColor = true;
241+
} elseif ($luminance < 0.2) {
242+
$isBrightColor = false;
243+
}
244+
$color = $this->util->elementColor($primaryColor, $isBrightColor);
238245
$svg = $this->util->colorizeSvg($svg, $color);
239246
return $svg;
240247
} else {

0 commit comments

Comments
 (0)