MCPcopy Create free account
hub / github.com/simstudioai/sim / applyShade

Function applyShade

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

Source from the content-addressed store, hash-verified

49 * shade: 0-100000 where 100000 = original color, 0 = fully black.
50 */
51export 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.

Callers 1

applyColorModifiersFunction · 0.85

Calls 4

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

Tested by

no test coverage detected