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

Function toCssColor

apps/sim/lib/colors/convert.ts:95–100  ·  view source on GitHub ↗
(color: string, alpha: number)

Source from the content-addressed store, hash-verified

93 * fully opaque, otherwise `rgba(r,g,b,a)`. Accepts hex with or without `#`.
94 */
95export function toCssColor(color: string, alpha: number): string {
96 const hex = color.startsWith('#') ? color : `#${color}`
97 if (alpha >= 1) return hex
98 const { r, g, b } = hexToRgb(hex)
99 return `rgba(${r},${g},${b},${alpha.toFixed(3)})`
100}

Callers 11

mergeRunPropsFunction · 0.90
resolveGradientForTextFunction · 0.90
resolveColorToCssFunction · 0.90
resolveFillFunction · 0.90
resolvePatternFillFunction · 0.90
resolveGradientFunction · 0.90
resolveLineStyleFunction · 0.90
resolveGradientFillNodeFunction · 0.90
resolveGradientStrokeFunction · 0.90
convert.test.tsFile · 0.90

Calls 1

hexToRgbFunction · 0.85

Tested by

no test coverage detected