-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vadim Demedes
committed
Feb 1, 2012
0 parents
commit 948ec0a
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Colorodo | ||
|
||
This is tiny helper for colored output in Terminal. | ||
|
||
# Installation | ||
|
||
``` | ||
npm install colorodo | ||
``` | ||
|
||
# Usage | ||
|
||
``` | ||
console.log('some nice text'.color('yellow')) | ||
``` | ||
|
||
# Available colors | ||
|
||
- Black | ||
- White | ||
- Blue | ||
- Red | ||
- Green | ||
- Yellow | ||
|
||
# There is tweet-sized version! | ||
|
||
``` | ||
String.prototype.color=function(c){l={black:30,red:31,green:32,yellow:33,blue:34,white:37};return"\033["+l[c]+"m"+this+"\033[0m"} | ||
``` | ||
|
||
# License | ||
|
||
**MIT**. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
String.prototype.color = function(color) { | ||
if(! color) color = 'green'; | ||
|
||
var colors = { | ||
black: 30, | ||
red: 31, | ||
green: 32, | ||
yellow: 33, | ||
blue: 34, | ||
white: 37 | ||
} | ||
|
||
return "\033[" + colors[color.toLowerCase()] + "m" + this.toString() + "\033[0m"; | ||
} | ||
|
||
/* Tweet version | ||
String.prototype.color=function(c){l={black:30,red:31,green:32,yellow:33,blue:34,white:37};return"\033["+l[c]+"m"+this+"\033[0m"} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "colorodo", | ||
"version": "1.0", | ||
"author": "Vadim Demedes <sbioko@gmail.com>", | ||
"main": "./index.js", | ||
"license": "MIT", | ||
"engine": { "node": ">=0.4" }, | ||
"repository": { "type": "git", "url": "https://github.com/vdemedes/colorodo.git" } | ||
} |