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
0 parents
commit 296e23d
Showing
6 changed files
with
98 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,4 @@ | ||
.DS_Store | ||
|
||
.idea/ | ||
npm-debug.log |
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,5 @@ | ||
.DS_Store | ||
.git* | ||
.idea/ | ||
|
||
npm-debug.log |
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 @@ | ||
(The MIT License) | ||
|
||
Copyright (c) 2011 christos "constantology" constandinou http://muigui.com | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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,46 @@ | ||
# ansi pansi | ||
|
||
Basic ansi formatting, foreground and background colours for use with CLIs. | ||
|
||
## installation | ||
|
||
``` | ||
npm install ansi-pansi | ||
``` | ||
|
||
## usage | ||
|
||
```javascript | ||
|
||
var ansiformat = require( 'ansi-pansi' ); | ||
|
||
console.log( ansiformat( 'foo', 'bold blue bg_yellow' ) ); | ||
// prints => 'foo' to the console in blue, bold on a yellow background. | ||
|
||
``` | ||
|
||
## formatting and colour options | ||
You can use the below codes concatenated with either a plus `+` or a space ` ` character as shown in the example above. | ||
|
||
### formatting | ||
`bold`, `italic`, `underline`, `blink`, `reverse`, `hidden`. | ||
|
||
### foreground colours | ||
`black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white` | ||
|
||
### background colours | ||
`bg_black`, `bg_red`, `bg_green`, `bg_yellow`, `bg_blue`, `bg_magenta`, `bg_cyan`, `bg_white` | ||
|
||
## License | ||
|
||
(The MIT License) | ||
|
||
Copyright © 2012 christos "constantology" constandinou http://muigui.com | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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,14 @@ | ||
var code = { | ||
reset : 0, | ||
// formatting | ||
bold : 1, italic : 3, underline : 4, blink : 5, reverse : 7, hidden : 8, | ||
// foreground colours | ||
black : 30, red : 31, green : 32, yellow : 33, blue : 34, magenta : 35, cyan : 36, white : 37, | ||
// background colours | ||
bg_black : 40, bg_red : 41, bg_green : 42, bg_yellow : 43, bg_blue : 44, bg_magenta : 45, bg_cyan : 46, bg_white : 47 | ||
}; | ||
|
||
exports = function ansi_pansi( str, colour ) { | ||
var f = colour.split( /[\s\+]/ ).reduce( function( s, a ) { return ( a in code ) ? s += code[a] + ';' : s; }, '' ); | ||
return ( f.length ? '\033[' + f + 'm' : f ) + str + '\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,20 @@ | ||
{ | ||
"author" : { | ||
"name" : "constantology", | ||
"email" : "constantology@gmail.com", | ||
"url" : "http://muigui.com" | ||
}, | ||
"description" : "Basic ansi formatting, foreground and background colours for use with CLIs.", | ||
"keywords" : ["ansi", "color", "colour", "cli", "console"], | ||
"licenses" : [ { | ||
"type" : "MIT", | ||
"url" : "https://raw.github.com/constantology/ansi-pansi/master/LICENSE" | ||
} ], | ||
"main" : "./ansi-pansi.js", | ||
"name" : "ansi-pansi", | ||
"repository" : { | ||
"type" : "git", | ||
"url" : "git@github.com:constantology/ansi-pansi.git" | ||
}, | ||
"version" : "0.0.1" | ||
} |