True_Kart / src /lib /scoring.ts
naturality-abhirsc
Rebuild HealthCart app with Vite React Tailwind stack
bcb3d07
Raw History Blame Contribute Delete
457 Bytes
export function scoreColor(score: number): string {
if (score > 70) return "var(--score-high)";
if (score >= 40) return "var(--score-mid)";
return "var(--score-low)";
}
export function nutriBadgeClass(letter: "A" | "B" | "C" | "D" | "E"): string {
const map: Record<string, string> = {
A: "bg-emerald-600",
B: "bg-lime-600",
C: "bg-amber-600",
D: "bg-orange-600",
E: "bg-red-600",
};
return map[letter] ?? "bg-slate-600";
}