Returns an object with the type and values of a color

Use in your code Learn more
bit import materialui.colors/manipulation/decompose-color

decomposeColor (color:string) : {type: string, values: Array.<number>}

Returns an object with the type and values of a color. Note: Does not support rgb % values and color names.

Example

 decomposeColor('rgb(255, 255, 255)') // => { type: 'rgb', values: [ 255, 255, 255 ] }

Argument

color: string

CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()

Returns

{type: string, values: Array.<number>}

A MUI color object

Test Summary

decomposeColor converts an rgb color string to an object with `type` and `value` keysPass
decomposeColor converts an rgba color string to an object with `type` and `value` keysPass
decomposeColor converts an hsl color string to an object with `type` and `value` keysPass
decomposeColor converts an hsla color string to an object with `type` and `value` keysPass