// Named label colors. Class strings are spelled out in full so Tailwind generates them. export const LABEL_COLORS = [ "gray", "red", "orange", "amber", "yellow", "lime", "green", "emerald", "teal", "cyan", "sky", "blue", "indigo", "violet", "purple", "fuchsia", "pink", "rose", ] as const; export type LabelColor = (typeof LABEL_COLORS)[number]; export function isLabelColor(v: unknown): v is LabelColor { return typeof v === "string" && (LABEL_COLORS as readonly string[]).includes(v); } /** Pill: border + tinted background + readable text in both themes. */ export const BADGE_CLASS: Record = { gray: "border-zinc-500/30 bg-zinc-500/10 text-zinc-700 dark:text-zinc-300", red: "border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300", orange: "border-orange-500/30 bg-orange-500/10 text-orange-700 dark:text-orange-300", amber: "border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300", yellow: "border-yellow-500/30 bg-yellow-500/10 text-yellow-700 dark:text-yellow-300", lime: "border-lime-500/30 bg-lime-500/10 text-lime-700 dark:text-lime-300", green: "border-green-500/30 bg-green-500/10 text-green-700 dark:text-green-300", emerald: "border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300", teal: "border-teal-500/30 bg-teal-500/10 text-teal-700 dark:text-teal-300", cyan: "border-cyan-500/30 bg-cyan-500/10 text-cyan-700 dark:text-cyan-300", sky: "border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300", blue: "border-blue-500/30 bg-blue-500/10 text-blue-700 dark:text-blue-300", indigo: "border-indigo-500/30 bg-indigo-500/10 text-indigo-700 dark:text-indigo-300", violet: "border-violet-500/30 bg-violet-500/10 text-violet-700 dark:text-violet-300", purple: "border-purple-500/30 bg-purple-500/10 text-purple-700 dark:text-purple-300", fuchsia: "border-fuchsia-500/30 bg-fuchsia-500/10 text-fuchsia-700 dark:text-fuchsia-300", pink: "border-pink-500/30 bg-pink-500/10 text-pink-700 dark:text-pink-300", rose: "border-rose-500/30 bg-rose-500/10 text-rose-700 dark:text-rose-300", }; export const DOT_CLASS: Record = { gray: "bg-zinc-500", red: "bg-red-500", orange: "bg-orange-500", amber: "bg-amber-500", yellow: "bg-yellow-500", lime: "bg-lime-500", green: "bg-green-500", emerald: "bg-emerald-500", teal: "bg-teal-500", cyan: "bg-cyan-500", sky: "bg-sky-500", blue: "bg-blue-500", indigo: "bg-indigo-500", violet: "bg-violet-500", purple: "bg-purple-500", fuchsia: "bg-fuchsia-500", pink: "bg-pink-500", rose: "bg-rose-500", }; /** Colors used for tags that have no color set: picked from the name so they stay stable. */ const AUTO_TAG_COLORS: LabelColor[] = ["sky", "emerald", "amber", "rose", "violet", "cyan", "lime", "orange", "fuchsia", "teal"]; export function autoTagColor(name: string): LabelColor { let h = 0; for (const ch of name.trim().toLowerCase()) h = (h * 31 + ch.codePointAt(0)!) >>> 0; return AUTO_TAG_COLORS[h % AUTO_TAG_COLORS.length]; }