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

Function applyLumMod

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

Source from the content-addressed store, hash-verified

64 * Multiplies the L channel of HSL.
65 */
66export function applyLumMod(hex: string, lumMod: number): string {
67 const { r, g, b } = hexToRgb(hex)
68 const { h, s, l } = rgbToHsl(r, g, b)
69 const newL = Math.max(0, Math.min(1, l * (lumMod / 100000)))
70 const rgb = hslToRgb(h, s, newL)
71 return rgbToHex(rgb.r, rgb.g, rgb.b)
72}
73
74/**
75 * Apply luminance offset.

Callers 1

applyColorModifiersFunction · 0.85

Calls 4

hexToRgbFunction · 0.90
rgbToHslFunction · 0.90
hslToRgbFunction · 0.90
rgbToHexFunction · 0.90

Tested by

no test coverage detected