@chriscodesthings/rgb-color-fade
v1.0.0
Published
Lightens or darkens an RGB or RGBA color towards white or black
Downloads
7
Maintainers
Readme
rgb-color-fade ·
Lightens or darkens an RGB or RGBA color towards white or black
Install
npm install --save @chriscodesthings/rgb-color-fade
Use
import rgbColorFade from '@chriscodesthings/rgb-color-fade';
console.log(rgbColorFade([100, 149, 237], -20)); // cornflowerblue, 20% darker
// => true
Syntax
rgbColorFade(col, fade);
Parameters
- col: an array containing red, green, blue and (optional) alpha values
- fade: a percentage from -100 to 100. Negative values fade towards black, positive towards white.
Return Value
Returns an array containing the new red, green, blue and (if originally present) alpha values.
Note, the alpha channel is not modified
Description
Does what it says on the tin.