Skip to content

Commit

Permalink
updated color example and major revision bump for breaking color change
Browse files Browse the repository at this point in the history
  • Loading branch information
gangstead committed Feb 8, 2016
1 parent 2b5a1ad commit a0a47e8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 18 deletions.
34 changes: 17 additions & 17 deletions README.md
Expand Up @@ -313,25 +313,25 @@ addition, prompt supports ANSI color codes via the
very colorful example:

``` js
var prompt = require("prompt");

//
// Setting these properties customizes the prompt.
//
prompt.message = "Question!".rainbow;
prompt.delimiter = "><".green;
var prompt = require("../lib/prompt");
var colors = require("colors/safe");
//
// Setting these properties customizes the prompt.
//
prompt.message = colors.rainbow("Question!");
prompt.delimiter = colors.green("><");

prompt.start();
prompt.start();

prompt.get({
properties: {
name: {
description: "What is your name?".magenta
}
prompt.get({
properties: {
name: {
description: colors.magenta("What is your name?")
}
}, function (err, result) {
console.log("You said your name is: ".cyan + result.name.cyan);
});
}
}, function (err, result) {
console.log(colors.cyan("You said your name is: " + result.name));
});
```

If you don't want colors, you can set
Expand All @@ -355,7 +355,7 @@ test_prompt(_);
```

This will work, however the process is then stuck with a stdin stream still open. If you setup the traditional way (with callback) such as this

```
prompt.start();
function test_prompt(){
Expand Down
19 changes: 19 additions & 0 deletions examples/color.js
@@ -0,0 +1,19 @@
var prompt = require("../lib/prompt");
var colors = require("colors/safe");
//
// Setting these properties customizes the prompt.
//
prompt.message = colors.rainbow("Question!");
prompt.delimiter = colors.green("><");

prompt.start();

prompt.get({
properties: {
name: {
description: colors.magenta("What is your name?")
}
}
}, function (err, result) {
console.log(colors.cyan("You said your name is: " + result.name));
});
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "prompt",
"description": "A beautiful command-line prompt for node.js",
"version": "0.3.0",
"version": "1.0.0",
"author": "Nodejitsu Inc. <info@nodejitsu.com>",
"maintainers": [
"indexzero <charlie@nodejitsu.com>",
Expand Down

0 comments on commit a0a47e8

Please sign in to comment.