Skip to content

conversion-library / hexRgbsToRgbArray

Function: hexRgbsToRgbArray()

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

hexRgbsToRgbArray

version: v0.0.6+

Parameters

color: string

输入 #rgb / #rrggbb / #rgba / #rrggbbaa

Returns

number[]

返回 array [r, g, b, a?]

Example

ts
hexRgbsToRgbArray('#fff')
// [255, 255, 255]
hexRgbsToRgbArray('#3456')
// [51, 68, 85, 0.4]
hexRgbsToRgbArray('#33445566')
// [51, 68, 85, 0.4]

Defined in

lib/color-conversion/hexAndRgb.ts:104