Skip to content

Commit

Permalink
use brighten and darken instead of grey
Browse files Browse the repository at this point in the history
Signed-off-by: Simon L <[email protected]>
  • Loading branch information
szaimen committed May 10, 2023
1 parent b70b1f6 commit eb87705
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/theming/lib/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ public function elementColor($color, ?bool $brightBackground = null) {
$luminance = $this->calculateLuminance($color);

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 the color is too bright in bright mode, we fall back to a darkened color
return $this->darken($color, 30);
}

if ($brightBackground !== true && $luminance < 0.2) {
// If the color is too dark in dark mode, we fall back to a brighter gray
return '#8c8c8c';
// If the color is too dark in dark mode, we fall back to a brightened color
return $this->lighten($color, 30);
}

return $color;
Expand Down

0 comments on commit eb87705

Please sign in to comment.