LinearGradientPicker
Small library to programmatically pick the color at a given position in a linear-gradient.
Usage
Install lib
npm install linear-gradient-picker --save-dev
// Import and create object;const picker = ; //Add color stopspicker ; //Pick at positions :console; // => { r: 13, g: 24, b: 153, a: 1 }console; // => { r: 31, g: 124, b: 227, a: 1 }console; // => { r: 46, g: 171, b: 243, a: 1 }console; // => { r: 247, g: 242, b: 108, a: 1 }
API
picker
Add a color stop to the gradient.
color
:
- an hex string of length 3 (i.e #000), 4 (i.e #000f), 7 (i.e #000000) or 9 (i.e #000000ff).
- an object
{ r, g, b }
or{ r, g, b, a }
- an array of integers
[r, g, b]
or[r, g, b, a]
position
a number in range [0; 100]
picker;
position
a number in range [0; 100]