A lib for easily translating and manipulating colors and sets of colors centered around xterm-256 pallette
Hop aboard the rainbow. Have some colors. I found all existing libs out there either not adequate for my needs and usually lacking most of the tools I wanted.
The api is designed to be very easy to use. The base exports is the Rainbow function which attempts to determine from given inputs what type of color you want.
var rainbow = require'repl-rainbow';// explicitrainbow'hsl' 180 1 0.5;// guessing from numbersrainbow25500; //rgbrainbow50 //ansi// arrays workrainbow25500;
Aside from the main function there's also a direct function for each. They all have identical methods. RGB has an rgb method that returns itself, for example, for the sake of consistency.
The differences are:
The common api is:
nlength with colors interpolating to
cin that color space
A few bonus extras are avaiable on Ansi types
bgto true to get the bg escape
bgto true for the bg escape
The return type for operations that return sets is
ColorSet. A ColorSet is just an array with a bit of extra functionality. All the Array functions that return new arrays are wrapped so that you always get back a ColorSet. This allows you to do multiple filters and mappings and still have a ColorSet.