MCPcopy Index your code
hub / github.com/simstudioai/sim / applyTint

Function applyTint

apps/sim/lib/pptx-renderer/utils/color.ts:34–45  ·  view source on GitHub ↗
(hex: string, tint: number)

Source from the content-addressed store, hash-verified

32 * PowerPoint performs the blend in linear RGB space for perceptual correctness.
33 */
34export 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).

Callers 2

renderShapeFunction · 0.90
applyColorModifiersFunction · 0.85

Calls 4

hexToRgbFunction · 0.90
rgbToHexFunction · 0.90
srgbToLinearFunction · 0.85
linearToSrgbFunction · 0.85

Tested by

no test coverage detected