added defaults for colors (#915)

This commit is contained in:
Darren Schroeder 2022-02-03 07:03:47 -06:00 committed by GitHub
parent b9c2bf226f
commit 0043b9da74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -217,42 +217,46 @@ Primitive values are things like `int` and `string`. Primitive values and flatsh
This is the current list of primitives. Not all of these are configurable. The configurable ones are marked with *. This is the current list of primitives. Not all of these are configurable. The configurable ones are marked with *.
* `any` | primitive | default color | configurable |
* `binary` * | - | - | - |
* `block` * | `any`|| |
* `bool` * | `binary`|Color::White.normal()| * |
* `cellpath` * | `block`|Color::White.normal()| * |
* `condition` | `bool`|Color::White.normal()| * |
* `custom` | `cellpath`|Color::White.normal()| * |
* `date` * | `condition`|| |
* `duration` * | `custom`|| |
* `expression` | `date`|Color::White.normal()| * |
* `filesize` * | `duration`|Color::White.normal()| * |
* `float` * | `expression`|| |
* `glob` | `filesize`|Color::White.normal()| * |
* `import` | `float`|Color::White.normal()| * |
* `int` * | `glob`|| |
* `list` * | `import`|| |
* `nothing` * | `int`|Color::White.normal()| * |
* `number` | `list`|Color::White.normal()| * |
* `operator` | `nothing`|Color::White.normal()| * |
* `path` | `number`|| |
* `range` * | `operator`|| |
* `record` * | `path`|| |
* `signature` | `range`|Color::White.normal()| * |
* `string` * | `record`|Color::White.normal()| * |
* `table` | `signature`|| |
* `var` | `string`|Color::White.normal()| * |
* `vardecl` | `table`|| |
* `variable` | `var`|| |
| `vardecl`|| |
| `variable`|| |
#### special "primitives" (not really primitives but they exist solely for coloring) #### special "primitives" (not really primitives but they exist solely for coloring)
* `leading_trailing_space_bg` * | primitive | default color | configurable |
* `header` * | - | - | - |
* `empty` * | `leading_trailing_space_bg`|Color::Rgb(128, 128, 128))| *|
* `row_index` * | `header`|Color::Green.bold()| *|
* `hints` * | `empty`|Color::Blue.normal()| *|
| `row_index`|Color::Green.bold()| *|
| `hints`|Color::DarkGray.normal()| *|
Here's a small example of changing some of these values. Here's a small example of changing some of these values.
``` ```
@ -302,29 +306,31 @@ As mentioned above, `flatshape` is a term used to indicate the sytax coloring.
Here's the current list of flat shapes. Here's the current list of flat shapes.
* `flatshape_block` | flatshape | default style | configurable |
* `flatshape_bool` | - | - | - |
* `flatshape_custom` | `flatshape_block`| fg(Color::Blue).bold()| * |
* `flatshape_external` | `flatshape_bool`| fg(Color::LightCyan)| * |
* `flatshape_externalarg` | `flatshape_custom`| bold()| * |
* `flatshape_filepath` | `flatshape_external`| fg(Color::Cyan)| * |
* `flatshape_flag` | `flatshape_externalarg`| fg(Color::Green).bold()| * |
* `flatshape_float` | `flatshape_filepath`| fg(Color::Cyan)| * |
* `flatshape_garbage` | `flatshape_flag`| fg(Color::Blue).bold()| * |
* `flatshape_globpattern` | `flatshape_float`|fg(Color::Purple).bold() | * |
* `flatshape_int` | `flatshape_garbage`| fg(Color::White).on(Color::Red).bold()| * |
* `flatshape_internalcall` | `flatshape_globpattern`| fg(Color::Cyan).bold()| * |
* `flatshape_list` | `flatshape_int`|fg(Color::Purple).bold() | * |
* `flatshape_literal` | `flatshape_internalcall`| fg(Color::Cyan).bold()| * |
* `flatshape_nothing` | `flatshape_list`| fg(Color::Cyan).bold()| * |
* `flatshape_operator` | `flatshape_literal`| fg(Color::Blue)| * |
* `flatshape_range` | `flatshape_nothing`| fg(Color::LightCyan)| * |
* `flatshape_record` | `flatshape_operator`| fg(Color::Yellow)| * |
* `flatshape_signature` | `flatshape_range`| fg(Color::Yellow).bold()| * |
* `flatshape_string` | `flatshape_record`| fg(Color::Cyan).bold()| * |
* `flatshape_string_interpolation` | `flatshape_signature`| fg(Color::Green).bold()| * |
* `flatshape_table` | `flatshape_string`| fg(Color::Green)| * |
* `flatshape_variable` | `flatshape_string_interpolation`| fg(Color::Cyan).bold()| * |
| `flatshape_table`| fg(Color::Blue).bold()| * |
| `flatshape_variable`| fg(Color::Purple)| * |
Here's a small example of how to apply color to these items. Anything not specified will receive the default color. Here's a small example of how to apply color to these items. Anything not specified will receive the default color.
@ -346,12 +352,12 @@ The nushell prompt is configurable through these environment variables settings.
* `PROMPT_COMMAND_RIGHT`: Code to execute for setting up the *RIGHT* prompt (block) (see oh-my.nu in nu_scripts) * `PROMPT_COMMAND_RIGHT`: Code to execute for setting up the *RIGHT* prompt (block) (see oh-my.nu in nu_scripts)
* `PROMPT_INDICATOR` = "〉": The indicator printed after the prompt (by default ">"-like Unicode symbol) * `PROMPT_INDICATOR` = "〉": The indicator printed after the prompt (by default ">"-like Unicode symbol)
* `PROMPT_INDICATOR_VI_INSERT` = ": " * `PROMPT_INDICATOR_VI_INSERT` = ": "
* `PROMPT_INDICATOR_VI_VISUAL` = "v " * `PROMPT_INDICATOR_VI_NORMAL` = "v "
* `PROMPT_MULTILINE_INDICATOR` = "::: " * `PROMPT_MULTILINE_INDICATOR` = "::: "
Example: For a simple prompt one could do this. Note that `PROMPT_COMMAND` requires a `block` whereas the others require a `string`. Example: For a simple prompt one could do this. Note that `PROMPT_COMMAND` requires a `block` whereas the others require a `string`.
`> let-env PROMPT_COMMAND = { build-string (date now | date format '%m/%d/%Y %I:%M:%S%.3f') ': ' (pwd | decode utf-8 | path basename) }` `> let-env PROMPT_COMMAND = { build-string (date now | date format '%m/%d/%Y %I:%M:%S%.3f') ': ' (pwd | path basename) }`
If you don't like the default `PROMPT_INDICATOR` you could change it like this. If you don't like the default `PROMPT_INDICATOR` you could change it like this.