Share your code. Components are building blocks, you are the architect.

manipulation/decompose-color
v0.0.1
0.0.1
MIT
PUBLIC
38989
Build: pass
BuildPass
Build Status: pass
Returns an object with the type and values of a color

Please configure Bit as a scoped registry to install components with NPM.Learn more

npm config set '@bit:registry' https://node.bitsrc.io
Use manipulation/decompose-color in your project
npm i @bit/materialui.colors.manipulation.decompose-color
Copied

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

```js
 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