Socket
Socket
Sign inDemoInstall

gradient-string

Package Overview
Dependencies
9
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gradient-string

Beautiful gradients in terminal stdout


Version published
Maintainers
1
Install size
817 kB
Created

Readme

Source

gradient-string

Build Status npm XO code style

Beautiful gradients in terminal stdout

gradient-string

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

Built-in gradients

Dependencies

  • tinygradient - Generate gradients
  • chalk - Output colored text to terminal

License

MIT © Boris K

Keywords

FAQs

Last updated on 21 Jul 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc