Skip to content

Commit

Permalink
Add docs for new color and prefix settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed Mar 28, 2016
1 parent e1b780b commit 2f57991
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ Or install it yourself as:
* [2.2.6 required](#226-required)
* [2.2.7 validate](#227-validate)
* [2.2.8 messages](#228-messages)
* [2.2.9 prefix](#229-prefix)
* [2.2.10 active_color](#2210-active_color)
* [2.2.11 help_color](#2211-help_color)
* [2.3 keypress](#23-keypress)
* [2.4 multiline](#24-multiline)
* [2.5 mask](#25-mask)
Expand Down Expand Up @@ -335,6 +338,32 @@ prompt.ask('What is your email?') do |q|
end
```

### 2.2.9 prefix

You can prefix each question asked using the `:prefix` option. This option can be applied either globally for all prompts or individual for each one:

```ruby
prompt = TTY::Prompt.new(prefix: '[?] ')
```

### 2.2.10 active_color

All prompt types support `:active_color` option. In case of `select`, `multi_select`, `enum_select` or `expand` this color is used to highlight the currently selected choice. All the resulted inputs provided by user that are read in by the prompt as answer are highlighted with this color. This option can be applied either globablly for all prompts or individually.

```ruby
prompt.select('What size?', %w(Large Medium Small), active_color: :cyan)
```

Please (see pastel)[https://github.com/piotrmurach/pastel#3-supported-colors] for all supported colors.

### 2.2.11 help_color

Prompts such as `select`, `multi_select`, `expand` support `:help_color` which is used to customize the help text. This option can be applied either globablly for all prompts or individually.

```ruby
prompt.select('What size?', %w(Large Medium Small), help_color: :cyan)
```

### 2.3 keypress

In order to ask question with a single character or keypress answer use `keypress`:
Expand Down

0 comments on commit 2f57991

Please sign in to comment.