(hex: string, shade: number)
| 49 | * shade: 0-100000 where 100000 = original color, 0 = fully black. |
| 50 | */ |
| 51 | export function applyShade(hex: string, shade: number): string { |
| 52 | const { r, g, b } = hexToRgb(hex) |
| 53 | const s = shade / 100000 |
| 54 | return rgbToHex( |
| 55 | linearToSrgb(srgbToLinear(r) * s), |
| 56 | linearToSrgb(srgbToLinear(g) * s), |
| 57 | linearToSrgb(srgbToLinear(b) * s) |
| 58 | ) |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Apply luminance modulation. |
no test coverage detected