color-it
Flat colors for your Node.js strings.
Last updated 9 years ago by ionicabizau .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install color-it 
SYNC missed versions from official npm registry.

color-it

color-it

Support me on Patreon Buy me a book PayPal Ask me anything Version Downloads Get help on Codementor

Buy Me A Coffee

Flat colors for your Node.js strings.

This library uses the flat colors taken from flatuicolors.com. For low-level libraries, check out flat-colors.js and node-couleurs.

color-it

:cloud: Installation

# Using npm
npm install --save color-it

# Using yarn
yarn add color-it

:clipboard: Example

const colorIt = require("color-it")
    , iterateObj = require("iterate-object")
    ;

// Red on dark blue
console.log("Hello " + colorIt("World").orange().wetAsphaltBg() + "!");

// Rainbow!
console.log(
    colorIt("Flat Colors Rainbow: ").gray()
  + "\n" + colorIt(" ".repeat(7)).red().redBg() + " " + colorIt("Red").red()
  + "\n" + colorIt(" ".repeat(7)).orange().orangeBg() + " " + colorIt("Orange").orange()
  + "\n" + colorIt(" ".repeat(7)).yellow().yellowBg() + " " + colorIt("Yellow").yellow()
  + "\n" + colorIt(" ".repeat(7)).green().greenBg() + " " + colorIt("Green").green()
  + "\n" + colorIt(" ".repeat(7)).blue().blueBg() + " " + colorIt("Blue").blue()
  + "\n" + colorIt(" ".repeat(7)).purple().purpleBg() + " " + colorIt("Purple").purple()
  + "\n" + colorIt(" ".repeat(7)).indigo().indigoBg() + " " + colorIt("Indigo").indigo()
);

// All the available colors
var allColors = ""
  , newLine = false
  ;

iterateObj(colorIt.prototype, function (_, c) {
    allColors += colorIt("colorIt." + c + "()")[c]() + " ";
    if (!!(newLine = !newLine)) {
        allColors += "\n";
    }
});
console.log("All the possible colors:\n" + allColors);

:question: Get Help

There are few ways to get help:

  1. Please post questions on Stack Overflow. You can open issues with questions, as long you add a link to your Stack Overflow question.
  2. For bug reports and feature requests, open issues. :bug:
  3. For direct and quick help, you can use Codementor. :rocket:

:memo: Documentation

ColorIt(text)

Creates a new ColorIt instance.

Available methods:

  • turquoise
  • emerland
  • peterRiver
  • amethyst
  • wetAsphalt
  • greenSea
  • nephritis
  • belizeHole
  • wisteria
  • midnightBlue
  • sunFlower
  • carrot
  • alizarin
  • clouds
  • concrete
  • orange
  • pumpkin
  • pomegranate
  • silver
  • asbestos

Also, the following methods are aliased, for convenience:

  • red :arrow_right: alizarin
  • yellow :arrow_right: sunFlower
  • green :arrow_right: emerland
  • blue :arrow_right: peterRiver
  • purple :arrow_right: amethyst
  • indigo :arrow_right: wisteria
  • gray :arrow_right: concrete

If you need to change the background color, add the Bg suffix to the method name (e.g. orange is for foreground, orangeBg is for background).

Params

  • String text: The text to color.

Return

  • ColorIt The ColorIt instance.

toString()

Convert the data to string (this can be called either manually or internally just by concatenating the ColorIt instance with another string).

Return

  • String Stringifies the data using ANSI styles.

:yum: How to contribute

Have an idea? Found a bug? See how to contribute.

:sparkling_heart: Support my projects

I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously, this takes time. You can integrate and use these projects in your applications for free! You can even change the source code and redistribute (even resell it).

However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:

  • Starring and sharing the projects you like :rocket:

  • Buy me a book—I love books! I will remember you after years if you buy me one. :grin: :book:

  • PayPal—You can make one-time donations via PayPal. I'll probably buy a coffee tea. :tea:

  • Support me on Patreon—Set up a recurring monthly donation and you will get interesting news about what I'm doing (things that I don't share with everyone).

  • Bitcoin—You can send me bitcoins at this address (or scanning the code below): 1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6

Thanks! :heart:

:dizzy: Where is this library used?

If you are using this library in one of your projects, add it in this list. :sparkles:

  • emoji-logger
  • node-charcoal
  • voila-cmd
  • @codhek/cf-cli
  • benchtable
  • git-unsaved

:scroll: License

MIT © Ionică Bizău

Current Tags

  • 1.2.12                                ...           latest (4 years ago)

15 Versions

  • 1.2.12                                ...           4 years ago
  • 1.2.11                                ...           6 years ago
  • 1.2.10                                ...           7 years ago
  • 1.2.9                                ...           8 years ago
  • 1.2.8                                ...           8 years ago
  • 1.2.7                                ...           8 years ago
  • 1.2.6                                ...           8 years ago
  • 1.2.5                                ...           8 years ago
  • 1.2.4                                ...           8 years ago
  • 1.2.3                                ...           8 years ago
  • 1.2.2                                ...           9 years ago
  • 1.2.1                                ...           9 years ago
  • 1.2.0                                ...           9 years ago
  • 1.1.0                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (0)
None
Dependents (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE