Migrate to a monorepo structure (#2909)
This commit is contained in:
13
packages/twenty-front/src/utils/string-to-hsl.ts
Normal file
13
packages/twenty-front/src/utils/string-to-hsl.ts
Normal file
@ -0,0 +1,13 @@
|
||||
export const 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