improve timezone discovery
This commit is contained in:
@@ -4,3 +4,18 @@ import { twMerge } from "tailwind-merge";
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
|
||||
export function getAvatarColor(name?: string): string {
|
||||
const colors = [
|
||||
'hsl(var(--tag-green))',
|
||||
'hsl(var(--tag-blue))',
|
||||
'hsl(var(--tag-orange))',
|
||||
'hsl(var(--tag-purple))',
|
||||
'hsl(var(--tag-brown))',
|
||||
];
|
||||
|
||||
if (!name) return colors[0];
|
||||
|
||||
const hash = name.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0);
|
||||
return colors[hash % colors.length];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user