(hex: string | undefined)
| 84 | } |
| 85 | |
| 86 | function luminance(hex: string | undefined) { |
| 87 | const rgb = hexToRgb(hex) |
| 88 | if (!rgb) return 0 |
| 89 | const channel = (value: number) => { |
| 90 | const normalized = value / 255 |
| 91 | return normalized <= 0.03928 ? normalized / 12.92 : ((normalized + 0.055) / 1.055) ** 2.4 |
| 92 | } |
| 93 | return 0.2126 * channel(rgb.r) + 0.7152 * channel(rgb.g) + 0.0722 * channel(rgb.b) |
| 94 | } |
| 95 | |
| 96 | function isResolvedLightTheme( |
| 97 | themeName: string, |
no test coverage detected