You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Lightweight JavaScript library, used to generate an array of color gradients by providing start and finish colors, as well as the required number of midpoints.</p>
Lightweight JavaScript library, used to generate an array of color gradients by providing start and finish colors, as well as the required number of midpoints.
11
-
12
-
## Demo
13
-
14
-
See [Live Preview on CodeSandbox](https://codesandbox.io/s/javascript-color-gradient-csgfd).
15
-
16
-
**Note:** All the examples are using ES6, be sure is supported in your browser or modify as needed, Chrome recommended.
17
11
18
12
## Installation
19
13
20
-
```bash
21
-
npm install javascript-color-gradient
22
-
```
23
-
24
-
or
14
+
For Node.js: Install the `javascript-color-gradient` npm module:
25
15
26
16
```bash
27
-
yarn add javascript-color-gradient
17
+
npm install javascript-color-gradient
28
18
```
29
19
30
-
## Usage
31
-
32
-
Using two color gradients
20
+
Then import the module into your JavaScript:
33
21
34
22
```javascript
35
23
importGradientfrom"javascript-color-gradient";
36
-
37
-
constcolorGradient=newGradient();
38
-
39
-
constcolor1="#3F2CAF";
40
-
constcolor2="#8BC2E3";
41
-
42
-
colorGradient.setGradient(color1, color2);
43
24
```
44
25
45
-
Or more:
46
-
47
-
```javascript
48
-
importGradientfrom"javascript-color-gradient";
49
-
50
-
constcolorGradient=newGradient();
51
-
52
-
constcolor1="#3F2CAF";
53
-
constcolor2="#e9446a";
54
-
constcolor3="#edc988";
55
-
constcolor4="#607D8B";
26
+
## Demo
56
27
57
-
colorGradient.setMidpoint(20);
28
+
[A demo is worth a thousand words](https://codesandbox.io/s/javascript-color-gradient-csgfd).
0 commit comments