| 1 | export function labelTextColor(hex: string): string { |
| 2 | const r = parseInt(hex.slice(1, 3), 16); |
| 3 | const g = parseInt(hex.slice(3, 5), 16); |
| 4 | const b = parseInt(hex.slice(5, 7), 16); |
| 5 | const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255; |
| 6 | return luminance > 0.5 ? "#000000" : "#ffffff"; |
| 7 | } |
| 8 | |