(hex: string, tint: number)
| 32 | * PowerPoint performs the blend in linear RGB space for perceptual correctness. |
| 33 | */ |
| 34 | export function applyTint(hex: string, tint: number): string { |
| 35 | const { r, g, b } = hexToRgb(hex) |
| 36 | const t = tint / 100000 |
| 37 | const rl = srgbToLinear(r) |
| 38 | const gl = srgbToLinear(g) |
| 39 | const bl = srgbToLinear(b) |
| 40 | return rgbToHex( |
| 41 | linearToSrgb(rl * t + 1.0 * (1 - t)), |
| 42 | linearToSrgb(gl * t + 1.0 * (1 - t)), |
| 43 | linearToSrgb(bl * t + 1.0 * (1 - t)) |
| 44 | ) |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Apply shade modifier (mix toward black in linear RGB space). |
no test coverage detected