Collection of convenience code snippets (helpers) that aims to make it a little easier to work with vanilla JS
vanillajs-helpers > “hexToRGB”
► hexToRGB(hex: string
): number
[]
Defined in hexToRGB.ts:20
Converts a Hexadecimal color to a RGB(A) color array
hexToRGB('#2fd466'); // -> [47, 212, 102]
// And with alpha channel
hexToRGB('#2fd46680'); // -> [47, 212, 102, 0.5]
Parameters:
Param | Type | Description |
---|---|---|
hex | string |
Hex color to convert to RGB |
Returns: number
[]