xi-conversations

Minimal clone of thunderbird conversations
git clone https://git.ce9e.org/xi-conversations.git

commit
51a672527402afac96376f940571df25d32e2121
parent
58ae872ac0e04aeca5e97710175cb6a9c4c421b0
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-09-12 17:09
use oklch in pseudoRandomColor()

Diffstat

M content/js/util.js 10 +---------

1 files changed, 1 insertions, 9 deletions


diff --git a/content/js/util.js b/content/js/util.js

@@ -97,15 +97,7 @@ export var pseudoRandomColor = function(s) {
   97    97 		hash &= 0xffff;
   98    98 	}
   99    99 	var hue = Math.floor(360 * hash / 0xffff);
  100    -1 
  101    -1 	// try to provide a consistent lightness across hues
  102    -1 	var lightnessStops = [48, 25, 28, 27, 62, 42];
  103    -1 	var j = Math.floor(hue / 60);
  104    -1 	var l1 = lightnessStops[j];
  105    -1 	var l2 = lightnessStops[(j + 1) % 6];
  106    -1 	var lightness = Math.floor((hue / 60 - j) * (l2 - l1) + l1);
  107    -1 
  108    -1 	return 'hsl(' + hue + ', 70%, ' + Math.floor(lightness) + '%)';
   -1   100 	return `oklch(53% 0.16 ${hue + 30})`;
  109   101 };
  110   102 
  111   103 export var parseContacts = function(raw) {