Files
yaak-mountain-loop/apps/yaak-client/lib/color.ts
2026-05-07 15:50:10 -07:00

21 lines
426 B
TypeScript

import type { Color } from "@yaakapp-internal/plugins";
const colors: Record<Color, boolean> = {
primary: true,
secondary: true,
success: true,
notice: true,
warning: true,
danger: true,
info: true,
};
export function stringToColor(str: string | null): Color | null {
if (!str) return null;
const strLower = str.toLowerCase();
if (strLower in colors) {
return strLower as Color;
}
return null;
}