Skip to content

Commit 6848c16

Browse files
gitburdnaomiquinones
authored andcommitted
[New] Added set-colors command. See details below:
This command allows users to replace default colors with their own custom colors. - top-level commands modified: alias, ls, ls-remote - helper functions added: nvm_echo_with_colors, nvm_err_with_colors, nvm_set_colors, nvm_get_colors, nvm_print_color_code - functions modified: nvm_print_formatted_alias, nvm_print_versions, nvm_print_alias_path (implicitly), nvm_print_default_alias (implicitly), nvm_list_aliases (implicitly) We added tests and info on using this command to the README! Co-authored-by: Dena Burd <[email protected]> Co-authored-by: Naomi Quinones <[email protected]>
1 parent 3abb981 commit 6848c16

13 files changed

+608
-21
lines changed

README.md

+39-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
- [io.js](#iojs)
2525
- [System Version of Node](#system-version-of-node)
2626
- [Listing Versions](#listing-versions)
27+
- [Setting Custom Colors](#setting-custom-colors)
28+
- [Persisting custom colors](#persisting-custom-colors)
2729
- [Suppressing colorized output](#suppressing-colorized-output)
2830
- [.nvmrc](#nvmrc)
2931
- [Deeper Shell Integration](#deeper-shell-integration)
@@ -380,12 +382,48 @@ If you want to see what versions are available to install:
380382
nvm ls-remote
381383
```
382384

385+
### Setting Custom Colors
386+
387+
You can set five colors that will be used to display version and alias information. These colors replace the default colors.
388+
Initial colors are: g b y r e
389+
390+
Color codes:
391+
392+
r/R = red / bold red
393+
394+
g/G = green / bold green
395+
396+
b/B = blue / bold blue
397+
398+
c/C = cyan / bold cyan
399+
400+
m/M = magenta / bold magenta
401+
402+
y/Y = yellow / bold yellow
403+
404+
k/K = black / bold black
405+
406+
e/W = light grey / white
407+
408+
```sh
409+
nvm set-colors rgBcm
410+
```
411+
412+
#### Persisting custom colors
413+
414+
If you want the custom colors to persist after terminating the shell, export the NVM_COLORS variable in your shell profile. For example, if you want to use cyan, magenta, green, bold red and bold yellow, add the following line:
415+
416+
```sh
417+
export NVM_COLORS='cmgRY'
418+
```
419+
383420
#### Suppressing colorized output
384421

385-
`nvm ls`, `nvm ls-remote` and `nvm alias` usually produce colorized output. You can disable colors with the `--no-colors` option (or by setting the environment variable `TERM=dumb`):
422+
`nvm help (or -h or --help)`, `nvm ls`, `nvm ls-remote` and `nvm alias` usually produce colorized output. You can disable colors with the `--no-colors` option (or by setting the environment variable `TERM=dumb`):
386423

387424
```sh
388425
nvm ls --no-colors
426+
nvm help --no-colors
389427
TERM=dumb nvm ls
390428
```
391429

0 commit comments

Comments
 (0)