(color: HexColor, value: { l?: number; c?: number; h?: number })
| 246 | } |
| 247 | |
| 248 | export function shift(color: HexColor, value: { l?: number; c?: number; h?: number }): HexColor { |
| 249 | const base = hexToOklch(color) |
| 250 | return oklchToHex({ |
| 251 | l: base.l + (value.l ?? 0), |
| 252 | c: base.c * (value.c ?? 1), |
| 253 | h: base.h + (value.h ?? 0), |
| 254 | }) |
| 255 | } |
| 256 | |
| 257 | export function contrastRatio(foreground: HexColor, background: HexColor) { |
| 258 | const linear = (c: number) => (c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4) |
no test coverage detected