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

Function applySatOff

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

Source from the content-addressed store, hash-verified

130 * Adds to the S channel of HSL.
131 */
132export function applySatOff(hex: string, satOff: number): string {
133 const { r, g, b } = hexToRgb(hex)
134 const { h, s, l } = rgbToHsl(r, g, b)
135 const newS = Math.max(0, Math.min(1, s + satOff / 100000))
136 const rgb = hslToRgb(h, newS, l)
137 return rgbToHex(rgb.r, rgb.g, rgb.b)
138}
139
140/**
141 * Convert OOXML alpha value (0-100000) to CSS opacity (0-1).

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