import { clsx, type ClassValue } from "clsx" import { twMerge } from "tailwind-merge" import { LABEL_COLORS, LabelColorName } from "./types" export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) } export function getHashColor(name: string): LabelColorName { let hash = 0; for (let i = 0; i < name.length; i++) { hash = name.charCodeAt(i) + ((hash << 5) - hash); } const colors = Object.keys(LABEL_COLORS) as LabelColorName[]; // Skip 'gray' for colorful tags const colorfulColors = colors.filter(c => c !== 'gray'); const colorIndex = Math.abs(hash) % colorfulColors.length; return colorfulColors[colorIndex]; }