Uniformize folder structure (#693)
* Uniformize folder structure * Fix icons * Fix icons * Fix tests * Fix tests
This commit is contained in:
13
front/src/utils/string-to-hsl.ts
Normal file
13
front/src/utils/string-to-hsl.ts
Normal file
@ -0,0 +1,13 @@
|
||||
export function stringToHslColor(
|
||||
str: string,
|
||||
saturation: number,
|
||||
lightness: number,
|
||||
) {
|
||||
let hash = 0;
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
||||
}
|
||||
|
||||
const h = hash % 360;
|
||||
return 'hsl(' + h + ', ' + saturation + '%, ' + lightness + '%)';
|
||||
}
|
||||
Reference in New Issue
Block a user