Color-Array
Functions for converting between CSS strings and rgba arrays. Functional rather than object orientated approach.
Install
npm install --save color-array
Color array from CSS
import { fromCss } from 'color-array'
fromCss('#fFf')
fromCss('#1a1a1a')
fromCss('rgb(10 , 4, 9 )')
fromCss('rgba(10 , 4, 9, 0.5 )')
fromCss('hsl(180, 60%, 50%)')
fromCss('hsla(180, 60%, 50%, .5)')
fromCss('pink')
Color array to CSS
import {
toCss,
toCssHex,
toCssRgb,
toCssRgba
} from 'color-array'
toCss([ 255, 255, 255, 1 ])
toCss([ 255, 255, 255, .5 ])
toCssHex([ 255, 255, 255 ])
toCssRgb([ 255, 255, 255 ])
toCssRgba([ 255, 255, 255, 1 ])
Interpolate Colors
import {
interpolateCss,
darkenCss,
lightenCss,
} from 'color-array'
interpolateCss('#f07', '0f7')
darkenCss('#fff', .5)
lightenCss('#000', .5)