Package Exports
- gradient-string
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gradient-string) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
gradient-string
Beautiful gradients in terminal stdout
Install
$ npm install --save gradient-string
Usage
const gradient = require('gradient-string');
console.log(gradient('cyan', 'pink')('Hello world!'));
Initialize a gradient
// Using varargs
let coolGradient = gradient('red', 'green', 'blue');
// Using array
let coolGradient = gradient(['#FF0000', '#00FF00', '#0000FF']);
The colors are parsed with TinyColor, multiple formats are accepted.
let coolGradient = gradient([
tinycolor('#FFBB65'), // tinycolor object
{r: 0, g: 255, b: 0}, // RGB object
{h: 240, s: 1, v: 1, a: 1}, // HSVa object
'rgb(120, 120, 0)', // RGB CSS string
'gold' // named color
]);
You can check out more advanced usages of gradients in the wiki, such as custom color stops or color interpolation options.
Use a gradient
let coolString = coolGradient('This is a string colored with gradient-string!');
console.log(coolString);
Built-in gradients
Usage
const gradient = require('gradient-string');
// Use the rainbow gradient
gradient.rainbow('I love gradient-strings!')
Available built-in gradients
Dependencies
- tinygradient - Generate gradients
- chalk - Output colored text to terminal
License
MIT © Boris K