Skip to content

Commit 9247d7c

Browse files
committed
TimeGrid\Util: Enhance entry color variation, somewhat
I'm still not convinced that this is good enough.
1 parent 18663f4 commit 9247d7c

File tree

1 file changed

+1
-1
lines changed
  • library/Notifications/Widget/TimeGrid

1 file changed

+1
-1
lines changed

library/Notifications/Widget/TimeGrid/Util.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static function calculateEntryColor(string $text, int $transparency): str
7272
// so if 500 thousand colors of these 16.7 millions are so similar that we can't distinguish them,
7373
// there's no need for such a high variance. Hence we'd still need to partition the colors in a way
7474
// that they are distinct enough.
75-
$hash = hexdec(hash('sha256', $text));
75+
$hash = hexdec(substr(hash('sha256', $text), 28, 8));
7676
// Limit the hue to a maximum of 360 as it's HSL's maximum of 360 degrees
7777
$h = (int) fmod($hash, 359.0); // TODO: Check if 359 is really of advantage here, instead of 360
7878
// The hue is already at least 1 degree off to every other, using a limited set of saturation values

0 commit comments

Comments
 (0)