0.2.4 • Published 11 years ago

colorplus v0.2.4

Weekly downloads
148
License
-
Repository
github
Last release
11 years ago

ColorPlus.js

A painless way to color your console in node.js.

Colorplus.js is a lazy option for those who want to print colored logs without learnning any other lib.

Colorplus in github

To Install

npm install colorplus

To Use

require("colorplus").enable();

console.log("Welcome".green, "To".bggreen, "Color".yellow, "Plus".red, "modules".bgblue.cyan);

Demo

screenshot


Examples

Setup

require("colorplus").enable();
console.log("This is ", "Color".red, "Plus".yellow, "Test");

Usage

Change the background color by prefix "bg"

console.log("Background".bggreen, "color".bgcyan, "test".bgyellow);

Use operator+ to avoid extra spaces in console.log

console.log("Background".bggreen + "color".bgcyan + "test".bgyellow);

Mix color and bgcolor

console.log(" ~ WARNING COLOR ~".bgred.yellow);

You may use colorplus.js to produce ansi color code.

var cp = require("colorplus").enable();
console.log(cp.bggreen, "Background", cp.bgcyan, "color", cp.bgyellow, "test", cp.r);
console.log(cp.bggreen + "Background" + cp.bgcyan + "color" + cp.bgyellow + "test" + cp.r);
console.log(cp.bgred, cp.yellow, " ~ WARNING COLOR ~", cp.r);

Setup without modifying String.prototype

Only when you don't want colorplus adds attributes to your String :

var cp = require("colorplus");
console.log("This is", cp.yellow, "Color", cp.red, "Plus", cp.r, "Test");

Color List

screenshot

License

Copyright(C) 2013 PG @ SENSE Lab

This project is distributed under the MIT License.

Todo list

  • (Done) I'm planning to apply the function to String.prototype. So you may use String("test").red to color it.
  • DarkColor (document not ready yet)
  • CustomCode (document not ready yet)

Feel free to improve this module by give me suggestion or pull requests.

0.2.4

11 years ago

0.2.3

11 years ago

0.2.2

11 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.0

11 years ago