Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadim Demedes committed Feb 1, 2012
0 parents commit 948ec0a
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
34 changes: 34 additions & 0 deletions README.md
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**.
18 changes: 18 additions & 0 deletions index.js
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"}
*/
9 changes: 9 additions & 0 deletions package.json
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" }
}

0 comments on commit 948ec0a

Please sign in to comment.