const red = '#EC6662' const yellow = '#ffbb54' const green = '#02a389' export { red, yellow, green } // red // #EC6662 // #F1908C // #F5B7B3 // #FADBDA // #FDF0EF // // yellow // #F4BE66 // #F7CF8F // #F9DFB6 // #FDEFDB // #FEF9F0 // // green // #02a389 // #7BB9AA // #A9D1C6 // #D5E8E2 // #EEF6F4 const green1 = '#02a389' const green2 = '#7BB9AA' const green3 = '#A9D1C6' const green4 = '#D5E8E2' const green5 = '#EEF6F4' export { green1, green2, green3, green4, green5 } const yellow1 = '#F4BE66' const yellow2 = '#F7CF8F' const yellow3 = '#F9DFB6' const yellow4 = '#FDEFDB' const yellow5 = '#FEF9F0' export { yellow1, yellow2, yellow3, yellow4, yellow5 } const red1 = '#EC6662' const red2 = '#F1908C' const red3 = '#F5B7B3' const red4 = '#FADBDA' const red5 = '#FDF0EF' export { red1, red2, red3, red4, red5 } export function clampPercent(value?: number): number { const n = Math.round(Number(value ?? 0)) if (Number.isNaN(n)) return 0 return Math.max(0, Math.min(100, n)) } export function scoreToColorHex(score: number): string { const pct = clampPercent(score) if (pct <= 33) return red if (pct <= 66) return yellow return green } export function scoreToCssVar(score: number): string { const pct = clampPercent(score) if (pct <= 33) return `var(--status-negative, ${red})` if (pct <= 66) return `var(--status-neutral, ${yellow})` return `var(--status-positive, ${green})` } export function hexToRgba(hex: string, alpha: number): string { const clean = hex.replace('#', '') const r = parseInt(clean.substring(0, 2), 16) const g = parseInt(clean.substring(2, 4), 16) const b = parseInt(clean.substring(4, 6), 16) return `rgba(${r}, ${g}, ${b}, ${alpha})` } export function matchLabelToColor(label: string): string { const l = (label || '').toLowerCase(); if (l.includes('optimal') || l.includes('strong')) return green if (l.includes('partial')) return yellow return red }