Comparing version 0.6.2 to 1.0.0
@@ -1,5 +0,6 @@ | ||
Copyright (c) 2010 | ||
Original Library | ||
- Copyright (c) Marak Squires | ||
Marak Squires | ||
Alexis Sellier (cloudhead) | ||
Additional Functionality | ||
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) | ||
@@ -6,0 +7,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
{ | ||
"name": "colors", | ||
"description": "get colors in your node.js console like what", | ||
"version": "0.6.2", | ||
"description": "get colors in your node.js console", | ||
"version": "1.0.0", | ||
"author": "Marak Squires", | ||
@@ -13,6 +13,10 @@ "homepage": "https://github.com/Marak/colors.js", | ||
}, | ||
"license": "MIT", | ||
"scripts": { | ||
"test": "node tests/basic-test.js && node tests/safe-test.js" | ||
}, | ||
"engines": { | ||
"node": ">=0.1.90" | ||
}, | ||
"main": "colors" | ||
"main": "./lib/index" | ||
} |
150
ReadMe.md
@@ -1,5 +0,6 @@ | ||
# colors.js - get color and style in your node.js console ( and browser ) like what | ||
# colors.js | ||
<img src="http://i.imgur.com/goJdO.png" border = "0"/> | ||
## get color and style in your node.js console | ||
<img src="https://github.com/Marak/colors.js/raw/master/screenshots/colors.png"/> | ||
@@ -12,33 +13,104 @@ ## Installation | ||
- bold | ||
- italic | ||
- underline | ||
- inverse | ||
- yellow | ||
- cyan | ||
- white | ||
- magenta | ||
- green | ||
- red | ||
- grey | ||
- blue | ||
- rainbow | ||
- zebra | ||
- random | ||
### text colors | ||
- black | ||
- red | ||
- green | ||
- yellow | ||
- blue | ||
- magenta | ||
- cyan | ||
- white | ||
- gray | ||
- grey | ||
### background colors | ||
- bgBlack | ||
- bgRed | ||
- bgGreen | ||
- bgYellow | ||
- bgBlue | ||
- bgMagenta | ||
- bgCyan | ||
- bgWhite | ||
### styles | ||
- reset | ||
- bold | ||
- dim | ||
- italic | ||
- underline | ||
- inverse | ||
- hidden | ||
- strikethrough | ||
### extras | ||
- rainbow | ||
- zebra | ||
- america | ||
- trap | ||
- random | ||
## Usage | ||
``` js | ||
var colors = require('./colors'); | ||
By popular demand, `colors` now ships with two types of usages! | ||
The super nifty way | ||
```js | ||
var colors = require('colors'); | ||
console.log('hello'.green); // outputs green text | ||
console.log('i like cake and pies'.underline.red) // outputs red underlined text | ||
console.log('inverse the color'.inverse); // inverses the color | ||
console.log('OMG Rainbows!'.rainbow); // rainbow (ignores spaces) | ||
console.log('OMG Rainbows!'.rainbow); // rainbow | ||
console.log('Run the trap'.trap); // Drops the bass | ||
``` | ||
# Creating Custom themes | ||
or a slightly less nifty way which doesn't extend `String.prototype` | ||
```js | ||
var colors = require('colors/safe'); | ||
console.log(colors.green('hello')); // outputs green text | ||
console.log(colors.red.underline('i like cake and pies')) // outputs red underlined text | ||
console.log(colors.inverse('inverse the color')); // inverses the color | ||
console.log(colors.rainbow('OMG Rainbows!')); // rainbow | ||
console.log(colors.trap('Run the trap')); // Drops the bass | ||
``` | ||
I prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way. | ||
If you are writing good code you will never have an issue with the first approach. If you really don't want to touch `String.prototype`, the second usage will not touch `String` native object. | ||
## Disabling Colors | ||
To disable colors you can pass the following arguments in the command line to your application: | ||
```bash | ||
node myapp.js --no-color | ||
``` | ||
## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data) | ||
```js | ||
var name = 'Marak'; | ||
console.log(chalk.green('Hello %s'), name); | ||
// outputs -> 'Hello Marak' | ||
``` | ||
## Custom themes | ||
### Using standard API | ||
```js | ||
var colors = require('colors'); | ||
@@ -66,14 +138,32 @@ | ||
### Using string safe API | ||
### Contributors | ||
```js | ||
var colors = require('colors/safe'); | ||
Marak (Marak Squires) | ||
Alexis Sellier (cloudhead) | ||
mmalecki (Maciej Małecki) | ||
nicoreed (Nico Reed) | ||
morganrallen (Morgan Allen) | ||
JustinCampbell (Justin Campbell) | ||
ded (Dustin Diaz) | ||
// set single property | ||
var error = colors.red; | ||
error('this is red'); | ||
// set theme | ||
colors.setTheme({ | ||
silly: 'rainbow', | ||
input: 'grey', | ||
verbose: 'cyan', | ||
prompt: 'grey', | ||
info: 'green', | ||
data: 'grey', | ||
help: 'cyan', | ||
warn: 'yellow', | ||
debug: 'blue', | ||
error: 'red' | ||
}); | ||
#### , Marak Squires , Justin Campbell, Dustin Diaz (@ded) | ||
// outputs red text | ||
console.log(colors.error("this is an error")); | ||
// outputs yellow text | ||
console.log(colors.warn("this is a warning")); | ||
``` | ||
*Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.* |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
108997
22
720
0
167
2
1