- Added multi-provider AI infrastructure (OpenAI/Ollama) - Implemented real-time tag suggestions with debounced analysis - Created AI diagnostics and database maintenance tools in Settings - Added automated garbage collection for orphan labels - Refined UX with deterministic color hashing and interactive ghost tags
22 lines
663 B
TypeScript
22 lines
663 B
TypeScript
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];
|
|
}
|