MCPcopy Create free account
hub / github.com/LottieFiles/dotlottie-web / hexStringToRGBAInt

Function hexStringToRGBAInt

packages/web/src/utils.ts:18–29  ·  view source on GitHub ↗
(colorHex: string)

Source from the content-addressed store, hash-verified

16 * @returns RGBA value as a 32-bit integer, or 0 if invalid hex color
17 */
18export function hexStringToRGBAInt(colorHex: string): number {
19 if (!isHexColor(colorHex)) {
20 return 0;
21 }
22
23 let hex = colorHex.replace('#', '');
24
25 // Add alpha if it's not included
26 hex = hex.length === 6 ? `${hex}ff` : hex;
27
28 return parseInt(hex, 16);
29}
30
31/**
32 * Converts a hex color string to RGBA float components in [0, 1].

Callers 1

utils.test.tsFile · 0.90

Calls 1

isHexColorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…