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
The colors are parsed with TinyColor, [multiple formats are accepted](https://github.com/bgrins/TinyColor/blob/master/README.md#accepted-string-input).
41
36
42
37
```javascript
43
-
let coolGradient =gradient([
44
-
tinycolor('#FFBB65'), // tinycolor object
45
-
{r:0, g:255, b:0}, // RGB object
46
-
{h:240, s:1, v:1, a:1}, // HSVa object
47
-
'rgb(120, 120, 0)', // RGB CSS string
48
-
'gold'// named color
38
+
constcoolGradient=gradient([
39
+
tinycolor('#FFBB65'), // tinycolor object
40
+
{r:0, g:255, b:0 },// RGB object
41
+
{h:240, s:1, v:1, a:1}, // HSVa object
42
+
'rgb(120, 120, 0)', // RGB CSS string
43
+
'gold',// named color
49
44
]);
50
45
```
51
46
52
47
### Use a gradient
53
48
54
49
```javascript
55
-
let coolString =coolGradient('This is a fancy string!');
50
+
constcoolString=coolGradient('This is a fancy string!');
56
51
console.log(coolString);
57
52
```
58
53
@@ -61,10 +56,13 @@ console.log(coolString);
61
56
### Usage
62
57
63
58
```javascript
64
-
constgradient=require('gradient-string');
59
+
import { rainbow, pastel } from'gradient-string';
65
60
66
-
// Use the rainbow gradient
67
-
console.log(gradient.rainbow('I love gradient-strings!'))
61
+
// Use the pastel built-in gradient
62
+
console.log(pastel('I love gradient-string!'));
63
+
64
+
// Use the rainbow built-in gradient
65
+
console.log(rainbow('It is so pretty! 🌈'));
68
66
```
69
67
70
68
### Available built-in gradients
@@ -78,29 +76,28 @@ In some cases, you may want to apply the same horizontal gradient on each line o
78
76
You can use the `multiline()` method of a gradient to ensure that the colors are vertically aligned.
-[Shopify](https://shopify.com/) in [Shopify CLI](https://www.npmjs.com/package/@shopify/cli-kit?activeTab=dependencies#:~:text=gradient&text=string)
185
+
-[Microsoft](https://microsoft.com) in [@lage-run/reporters](https://www.npmjs.com/package/@lage-run/reporters?activeTab=dependencies#:~:text=gradient&text=string)
186
+
-[Tencent](https://www.tencent.com/) in [Cloudbase Framework](https://www.npmjs.com/package/@cloudbase/framework-core#:~:text=gradient&text=string)
187
+
-[Fireship](https://fireship.io/) in [this YouTube video](https://youtu.be/_oHByo8tiEY?si=3AKfAfOMXI0d9Ay6&t=76), where he shows how he built [javascript-millionaire](https://github.com/fireship-io/javascript-millionaire)
188
+
-[Turoborepo](https://turbo.build/) in [@turbo/workspaces](https://www.npmjs.com/package/@turbo/workspaces?activeTab=dependencies#:~:text=gradient&text=string) and [@turbo/codemod](https://www.npmjs.com/package/@turbo/codemod?activeTab=dependencies#:~:text=gradient&text=string)
189
+
-[Magic UI](https://magicui.design/) in [Magic UI CLI](https://www.npmjs.com/package/magicui-cli?activeTab=dependencies)
190
+
-[Myself](https://github.com/bokub) in [chalk-animation](https://github.com/bokub/chalk-animation), the animated version of gradient-string
191
+
-[Sindre Sorhus](https://github.com/sindresorhus) in [ink-gradient](https://www.npmjs.com/package/ink-gradient?activeTab=dependencies#:~:text=gradient&text=string), the [Ink](https://github.com/vadimdemedes/ink) version of gradient-string
192
+
-[And  more...](https://github.com/bokub/gradient-string/network/dependents), who downloaded gradient-string [ times!][downloads-href]
0 commit comments