Skip to content

conversion-library / rgbToRgbArray

Function: rgbToRgbArray()

ts
function rgbToRgbArray(color: string): number[]

rgbToRgbArray

version: v0.0.6+

Parameters

color: string

Enter rgb(r, g, b, a?)

Returns

number[]

Return array [r, g, b, a?]

Example

ts
rgbToRgbArray('rgb(255, 255, 255)')
// [255, 255, 255]
rgbToRgbArray('rgba(255, 0, 0, 0.33)')
// [255, 0, 0, 0.33]

Defined in

lib/color-conversion/hexAndRgb.ts:214