Skip to content

Commit

Permalink
TimeGrid\Util: Enhance entry color variation, somewhat
Browse files Browse the repository at this point in the history
I'm still not convinced that this is good enough.
  • Loading branch information
nilmerg committed Jun 12, 2024
1 parent 18663f4 commit 9247d7c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/Notifications/Widget/TimeGrid/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static function calculateEntryColor(string $text, int $transparency): str
// so if 500 thousand colors of these 16.7 millions are so similar that we can't distinguish them,
// there's no need for such a high variance. Hence we'd still need to partition the colors in a way
// that they are distinct enough.
$hash = hexdec(hash('sha256', $text));
$hash = hexdec(substr(hash('sha256', $text), 28, 8));
// Limit the hue to a maximum of 360 as it's HSL's maximum of 360 degrees
$h = (int) fmod($hash, 359.0); // TODO: Check if 359 is really of advantage here, instead of 360
// The hue is already at least 1 degree off to every other, using a limited set of saturation values
Expand Down

0 comments on commit 9247d7c

Please sign in to comment.