rename flatshape_* to shape_* (#4589)

This commit is contained in:
Darren Schroeder 2022-02-21 12:27:21 -06:00 committed by GitHub
parent 24fc9c657e
commit 88fa40d698
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 333 additions and 320 deletions

View File

@ -9,29 +9,29 @@ pub fn get_shape_color(shape: String, conf: &Config) -> Style {
Err(_) => Style::default(), Err(_) => Style::default(),
}, },
None => match shape.as_ref() { None => match shape.as_ref() {
"flatshape_garbage" => Style::new().fg(Color::White).on(Color::Red).bold(), "shape_garbage" => Style::new().fg(Color::White).on(Color::Red).bold(),
"flatshape_bool" => Style::new().fg(Color::LightCyan), "shape_bool" => Style::new().fg(Color::LightCyan),
"flatshape_int" => Style::new().fg(Color::Purple).bold(), "shape_int" => Style::new().fg(Color::Purple).bold(),
"flatshape_float" => Style::new().fg(Color::Purple).bold(), "shape_float" => Style::new().fg(Color::Purple).bold(),
"flatshape_range" => Style::new().fg(Color::Yellow).bold(), "shape_range" => Style::new().fg(Color::Yellow).bold(),
"flatshape_internalcall" => Style::new().fg(Color::Cyan).bold(), "shape_internalcall" => Style::new().fg(Color::Cyan).bold(),
"flatshape_external" => Style::new().fg(Color::Cyan), "shape_external" => Style::new().fg(Color::Cyan),
"flatshape_externalarg" => Style::new().fg(Color::Green).bold(), "shape_externalarg" => Style::new().fg(Color::Green).bold(),
"flatshape_literal" => Style::new().fg(Color::Blue), "shape_literal" => Style::new().fg(Color::Blue),
"flatshape_operator" => Style::new().fg(Color::Yellow), "shape_operator" => Style::new().fg(Color::Yellow),
"flatshape_signature" => Style::new().fg(Color::Green).bold(), "shape_signature" => Style::new().fg(Color::Green).bold(),
"flatshape_string" => Style::new().fg(Color::Green), "shape_string" => Style::new().fg(Color::Green),
"flatshape_string_interpolation" => Style::new().fg(Color::Cyan).bold(), "shape_string_interpolation" => Style::new().fg(Color::Cyan).bold(),
"flatshape_list" => Style::new().fg(Color::Cyan).bold(), "shape_list" => Style::new().fg(Color::Cyan).bold(),
"flatshape_table" => Style::new().fg(Color::Blue).bold(), "shape_table" => Style::new().fg(Color::Blue).bold(),
"flatshape_record" => Style::new().fg(Color::Cyan).bold(), "shape_record" => Style::new().fg(Color::Cyan).bold(),
"flatshape_block" => Style::new().fg(Color::Blue).bold(), "shape_block" => Style::new().fg(Color::Blue).bold(),
"flatshape_filepath" => Style::new().fg(Color::Cyan), "shape_filepath" => Style::new().fg(Color::Cyan),
"flatshape_globpattern" => Style::new().fg(Color::Cyan).bold(), "shape_globpattern" => Style::new().fg(Color::Cyan).bold(),
"flatshape_variable" => Style::new().fg(Color::Purple), "shape_variable" => Style::new().fg(Color::Purple),
"flatshape_flag" => Style::new().fg(Color::Blue).bold(), "shape_flag" => Style::new().fg(Color::Blue).bold(),
"flatshape_custom" => Style::new().fg(Color::Green), "shape_custom" => Style::new().fg(Color::Green),
"flatshape_nothing" => Style::new().fg(Color::LightCyan), "shape_nothing" => Style::new().fg(Color::LightCyan),
_ => Style::default(), _ => Style::default(),
}, },
} }

View File

@ -32,29 +32,29 @@ pub enum FlatShape {
impl Display for FlatShape { impl Display for FlatShape {
fn fmt(&self, f: &mut Formatter) -> Result { fn fmt(&self, f: &mut Formatter) -> Result {
match self { match self {
FlatShape::Garbage => write!(f, "flatshape_garbage"), FlatShape::Garbage => write!(f, "shape_garbage"),
FlatShape::Nothing => write!(f, "flatshape_nothing"), FlatShape::Nothing => write!(f, "shape_nothing"),
FlatShape::Bool => write!(f, "flatshape_bool"), FlatShape::Bool => write!(f, "shape_bool"),
FlatShape::Int => write!(f, "flatshape_int"), FlatShape::Int => write!(f, "shape_int"),
FlatShape::Float => write!(f, "flatshape_float"), FlatShape::Float => write!(f, "shape_float"),
FlatShape::Range => write!(f, "flatshape_range"), FlatShape::Range => write!(f, "shape_range"),
FlatShape::InternalCall => write!(f, "flatshape_internalcall"), FlatShape::InternalCall => write!(f, "shape_internalcall"),
FlatShape::External => write!(f, "flatshape_external"), FlatShape::External => write!(f, "shape_external"),
FlatShape::ExternalArg => write!(f, "flatshape_externalarg"), FlatShape::ExternalArg => write!(f, "shape_externalarg"),
FlatShape::Literal => write!(f, "flatshape_literal"), FlatShape::Literal => write!(f, "shape_literal"),
FlatShape::Operator => write!(f, "flatshape_operator"), FlatShape::Operator => write!(f, "shape_operator"),
FlatShape::Signature => write!(f, "flatshape_signature"), FlatShape::Signature => write!(f, "shape_signature"),
FlatShape::String => write!(f, "flatshape_string"), FlatShape::String => write!(f, "shape_string"),
FlatShape::StringInterpolation => write!(f, "flatshape_string_interpolation"), FlatShape::StringInterpolation => write!(f, "shape_string_interpolation"),
FlatShape::List => write!(f, "flatshape_list"), FlatShape::List => write!(f, "shape_list"),
FlatShape::Table => write!(f, "flatshape_table"), FlatShape::Table => write!(f, "shape_table"),
FlatShape::Record => write!(f, "flatshape_record"), FlatShape::Record => write!(f, "shape_record"),
FlatShape::Block => write!(f, "flatshape_block"), FlatShape::Block => write!(f, "shape_block"),
FlatShape::Filepath => write!(f, "flatshape_filepath"), FlatShape::Filepath => write!(f, "shape_filepath"),
FlatShape::GlobPattern => write!(f, "flatshape_globpattern"), FlatShape::GlobPattern => write!(f, "shape_globpattern"),
FlatShape::Variable => write!(f, "flatshape_variable"), FlatShape::Variable => write!(f, "shape_variable"),
FlatShape::Flag => write!(f, "flatshape_flag"), FlatShape::Flag => write!(f, "shape_flag"),
FlatShape::Custom(_) => write!(f, "flatshape_custom"), FlatShape::Custom(_) => write!(f, "shape_custom"),
} }
} }
} }

View File

@ -4,14 +4,16 @@ There are a few main parts that nushell allows you to change the color. All of t
1. table borders 1. table borders
2. primitive values 2. primitive values
3. flatshapes (this is the command line syntax) 3. shapes (this is the command line syntax)
4. prompt 4. prompt
5. LS_COLORS 5. LS_COLORS
## `Table borders` ## `Table borders`
___
---
Table borders are controlled by the `table_mode` setting in the `config.nu`. Here is an example: Table borders are controlled by the `table_mode` setting in the `config.nu`. Here is an example:
``` ```
let $config = { let $config = {
table_mode: rounded table_mode: rounded
@ -19,6 +21,7 @@ let $config = {
``` ```
Here are the current options for `table_mode`: Here are the current options for `table_mode`:
1. `rounded` # of course, this is the best one :) 1. `rounded` # of course, this is the best one :)
2. `basic` 2. `basic`
3. `compact` 3. `compact`
@ -33,165 +36,168 @@ Here are the current options for `table_mode`:
12. `other` 12. `other`
### `Color symbologies` ### `Color symbologies`
--- ---
* `r` - normal color red's abbreviation - `r` - normal color red's abbreviation
* `rb` - normal color red's abbreviation with bold attribute - `rb` - normal color red's abbreviation with bold attribute
* `red` - normal color red - `red` - normal color red
* `red_bold` - normal color red with bold attribute - `red_bold` - normal color red with bold attribute
* `"#ff0000"` - "#hex" format foreground color red (quotes are required) - `"#ff0000"` - "#hex" format foreground color red (quotes are required)
* `{ fg: "#ff0000" bg: "#0000ff" attr: b }` - "full #hex" format foreground red in "#hex" format with a background of blue in "#hex" format with an attribute of bold abbreviated. - `{ fg: "#ff0000" bg: "#0000ff" attr: b }` - "full #hex" format foreground red in "#hex" format with a background of blue in "#hex" format with an attribute of bold abbreviated.
### `attributes` ### `attributes`
--- ---
|code|meaning| | code | meaning |
|-|-| | ---- | ------------------- |
|l|blink| | l | blink |
|b|bold| | b | bold |
|d|dimmed| | d | dimmed |
|h|hidden| | h | hidden |
|i|italic| | i | italic |
|r|reverse| | r | reverse |
|s|strikethrough| | s | strikethrough |
|u|underline| | u | underline |
|n|nothing| | n | nothing |
||defaults to nothing| | | defaults to nothing |
### `normal colors` and `abbreviations` ### `normal colors` and `abbreviations`
|code|name| | code | name |
|-|-| | ------ | ---------------------- |
|g|green| | g | green |
|gb|green_bold| | gb | green_bold |
|gu|green_underline| | gu | green_underline |
|gi|green_italic| | gi | green_italic |
|gd|green_dimmed| | gd | green_dimmed |
|gr|green_reverse| | gr | green_reverse |
|gbl|green_blink| | gbl | green_blink |
|gst|green_strike| | gst | green_strike |
|lg|light_green| | lg | light_green |
|lgb|light_green_bold| | lgb | light_green_bold |
|lgu|light_green_underline| | lgu | light_green_underline |
|lgi|light_green_italic| | lgi | light_green_italic |
|lgd|light_green_dimmed| | lgd | light_green_dimmed |
|lgr|light_green_reverse| | lgr | light_green_reverse |
|lgbl|light_green_blink| | lgbl | light_green_blink |
|lgst|light_green_strike| | lgst | light_green_strike |
|r|red| | r | red |
|rb|red_bold| | rb | red_bold |
|ru|red_underline| | ru | red_underline |
|ri|red_italic| | ri | red_italic |
|rd|red_dimmed| | rd | red_dimmed |
|rr|red_reverse| | rr | red_reverse |
|rbl|red_blink| | rbl | red_blink |
|rst|red_strike| | rst | red_strike |
|lr|light_red| | lr | light_red |
|lrb|light_red_bold| | lrb | light_red_bold |
|lru|light_red_underline| | lru | light_red_underline |
|lri|light_red_italic| | lri | light_red_italic |
|lrd|light_red_dimmed| | lrd | light_red_dimmed |
|lrr|light_red_reverse| | lrr | light_red_reverse |
|lrbl|light_red_blink| | lrbl | light_red_blink |
|lrst|light_red_strike| | lrst | light_red_strike |
|u|blue| | u | blue |
|ub|blue_bold| | ub | blue_bold |
|uu|blue_underline| | uu | blue_underline |
|ui|blue_italic| | ui | blue_italic |
|ud|blue_dimmed| | ud | blue_dimmed |
|ur|blue_reverse| | ur | blue_reverse |
|ubl|blue_blink| | ubl | blue_blink |
|ust|blue_strike| | ust | blue_strike |
|lu|light_blue| | lu | light_blue |
|lub|light_blue_bold| | lub | light_blue_bold |
|luu|light_blue_underline| | luu | light_blue_underline |
|lui|light_blue_italic| | lui | light_blue_italic |
|lud|light_blue_dimmed| | lud | light_blue_dimmed |
|lur|light_blue_reverse| | lur | light_blue_reverse |
|lubl|light_blue_blink| | lubl | light_blue_blink |
|lust|light_blue_strike| | lust | light_blue_strike |
|b|black| | b | black |
|bb|black_bold| | bb | black_bold |
|bu|black_underline| | bu | black_underline |
|bi|black_italic| | bi | black_italic |
|bd|black_dimmed| | bd | black_dimmed |
|br|black_reverse| | br | black_reverse |
|bbl|black_blink| | bbl | black_blink |
|bst|black_strike| | bst | black_strike |
|ligr|light_gray| | ligr | light_gray |
|ligrb|light_gray_bold| | ligrb | light_gray_bold |
|ligru|light_gray_underline| | ligru | light_gray_underline |
|ligri|light_gray_italic| | ligri | light_gray_italic |
|ligrd|light_gray_dimmed| | ligrd | light_gray_dimmed |
|ligrr|light_gray_reverse| | ligrr | light_gray_reverse |
|ligrbl|light_gray_blink| | ligrbl | light_gray_blink |
|ligrst|light_gray_strike| | ligrst | light_gray_strike |
|y|yellow| | y | yellow |
|yb|yellow_bold| | yb | yellow_bold |
|yu|yellow_underline| | yu | yellow_underline |
|yi|yellow_italic| | yi | yellow_italic |
|yd|yellow_dimmed| | yd | yellow_dimmed |
|yr|yellow_reverse| | yr | yellow_reverse |
|ybl|yellow_blink| | ybl | yellow_blink |
|yst|yellow_strike| | yst | yellow_strike |
|ly|light_yellow| | ly | light_yellow |
|lyb|light_yellow_bold| | lyb | light_yellow_bold |
|lyu|light_yellow_underline| | lyu | light_yellow_underline |
|lyi|light_yellow_italic| | lyi | light_yellow_italic |
|lyd|light_yellow_dimmed| | lyd | light_yellow_dimmed |
|lyr|light_yellow_reverse| | lyr | light_yellow_reverse |
|lybl|light_yellow_blink| | lybl | light_yellow_blink |
|lyst|light_yellow_strike| | lyst | light_yellow_strike |
|p|purple| | p | purple |
|pb|purple_bold| | pb | purple_bold |
|pu|purple_underline| | pu | purple_underline |
|pi|purple_italic| | pi | purple_italic |
|pd|purple_dimmed| | pd | purple_dimmed |
|pr|purple_reverse| | pr | purple_reverse |
|pbl|purple_blink| | pbl | purple_blink |
|pst|purple_strike| | pst | purple_strike |
|lp|light_purple| | lp | light_purple |
|lpb|light_purple_bold| | lpb | light_purple_bold |
|lpu|light_purple_underline| | lpu | light_purple_underline |
|lpi|light_purple_italic| | lpi | light_purple_italic |
|lpd|light_purple_dimmed| | lpd | light_purple_dimmed |
|lpr|light_purple_reverse| | lpr | light_purple_reverse |
|lpbl|light_purple_blink| | lpbl | light_purple_blink |
|lpst|light_purple_strike| | lpst | light_purple_strike |
|c|cyan| | c | cyan |
|cb|cyan_bold| | cb | cyan_bold |
|cu|cyan_underline| | cu | cyan_underline |
|ci|cyan_italic| | ci | cyan_italic |
|cd|cyan_dimmed| | cd | cyan_dimmed |
|cr|cyan_reverse| | cr | cyan_reverse |
|cbl|cyan_blink| | cbl | cyan_blink |
|cst|cyan_strike| | cst | cyan_strike |
|lc|light_cyan| | lc | light_cyan |
|lcb|light_cyan_bold| | lcb | light_cyan_bold |
|lcu|light_cyan_underline| | lcu | light_cyan_underline |
|lci|light_cyan_italic| | lci | light_cyan_italic |
|lcd|light_cyan_dimmed| | lcd | light_cyan_dimmed |
|lcr|light_cyan_reverse| | lcr | light_cyan_reverse |
|lcbl|light_cyan_blink| | lcbl | light_cyan_blink |
|lcst|light_cyan_strike| | lcst | light_cyan_strike |
|w|white| | w | white |
|wb|white_bold| | wb | white_bold |
|wu|white_underline| | wu | white_underline |
|wi|white_italic| | wi | white_italic |
|wd|white_dimmed| | wd | white_dimmed |
|wr|white_reverse| | wr | white_reverse |
|wbl|white_blink| | wbl | white_blink |
|wst|white_strike| | wst | white_strike |
|dgr|dark_gray| | dgr | dark_gray |
|dgrb|dark_gray_bold| | dgrb | dark_gray_bold |
|dgru|dark_gray_underline| | dgru | dark_gray_underline |
|dgri|dark_gray_italic| | dgri | dark_gray_italic |
|dgrd|dark_gray_dimmed| | dgrd | dark_gray_dimmed |
|dgrr|dark_gray_reverse| | dgrr | dark_gray_reverse |
|dgrbl|dark_gray_blink| | dgrbl | dark_gray_blink |
|dgrst|dark_gray_strike| | dgrst | dark_gray_strike |
### `"#hex"` format ### `"#hex"` format
--- ---
The "#hex" format is one way you typically see colors represented. It's simply the `#` character followed by 6 characters. The first two are for `red`, the second two are for `green`, and the third two are for `blue`. It's important that this string be surrounded in quotes, otherwise nushell thinks it's a commented out string. The "#hex" format is one way you typically see colors represented. It's simply the `#` character followed by 6 characters. The first two are for `red`, the second two are for `green`, and the third two are for `blue`. It's important that this string be surrounded in quotes, otherwise nushell thinks it's a commented out string.
@ -201,64 +207,68 @@ Example: The primary `red` color is `"#ff0000"` or `"#FF0000"`. Upper and lower
This `"#hex"` format allows us to specify 24-bit truecolor tones to different parts of nushell. This `"#hex"` format allows us to specify 24-bit truecolor tones to different parts of nushell.
## `full "#hex"` format ## `full "#hex"` format
--- ---
The `full "#hex"` format is a take on the `"#hex"` format but allows one to specify the foreground, background, and attributes in one line. The `full "#hex"` format is a take on the `"#hex"` format but allows one to specify the foreground, background, and attributes in one line.
Example: `{ fg: "#ff0000" bg: "#0000ff" attr: b }` Example: `{ fg: "#ff0000" bg: "#0000ff" attr: b }`
* foreground of red in "#hex" format - foreground of red in "#hex" format
* background of blue in "#hex" format - background of blue in "#hex" format
* attribute of bold abbreviated - attribute of bold abbreviated
## `Primitive values` ## `Primitive values`
___
Primitive values are things like `int` and `string`. Primitive values and flatshapes can be set with a variety of color symbologies seen above. ---
This is the current list of primitives. Not all of these are configurable. The configurable ones are marked with *. Primitive values are things like `int` and `string`. Primitive values and shapes can be set with a variety of color symbologies seen above.
| primitive | default color | configurable | 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`|Color::White.normal()| * | | ------------ | --------------------- | ------------ |
| `block`|Color::White.normal()| * | | `any` | | |
| `bool`|Color::White.normal()| * | | `binary` | Color::White.normal() | \* |
| `cellpath`|Color::White.normal()| * | | `block` | Color::White.normal() | \* |
| `condition`|| | | `bool` | Color::White.normal() | \* |
| `custom`|| | | `cellpath` | Color::White.normal() | \* |
| `date`|Color::White.normal()| * | | `condition` | | |
| `duration`|Color::White.normal()| * | | `custom` | | |
| `expression`|| | | `date` | Color::White.normal() | \* |
| `filesize`|Color::White.normal()| * | | `duration` | Color::White.normal() | \* |
| `float`|Color::White.normal()| * | | `expression` | | |
| `glob`|| | | `filesize` | Color::White.normal() | \* |
| `import`|| | | `float` | Color::White.normal() | \* |
| `int`|Color::White.normal()| * | | `glob` | | |
| `list`|Color::White.normal()| * | | `import` | | |
| `nothing`|Color::White.normal()| * | | `int` | Color::White.normal() | \* |
| `number`|| | | `list` | Color::White.normal() | \* |
| `operator`|| | | `nothing` | Color::White.normal() | \* |
| `path`|| | | `number` | | |
| `range`|Color::White.normal()| * | | `operator` | | |
| `record`|Color::White.normal()| * | | `path` | | |
| `signature`|| | | `range` | Color::White.normal() | \* |
| `string`|Color::White.normal()| * | | `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)
| primitive | default color | configurable | | primitive | default color | configurable |
| - | - | - | | --------------------------- | -------------------------- | ------------ |
| `leading_trailing_space_bg`|Color::Rgb(128, 128, 128))| *| | `leading_trailing_space_bg` | Color::Rgb(128, 128, 128)) | \* |
| `header`|Color::Green.bold()| *| | `header` | Color::Green.bold() | \* |
| `empty`|Color::Blue.normal()| *| | `empty` | Color::Blue.normal() | \* |
| `row_index`|Color::Green.bold()| *| | `row_index` | Color::Green.bold() | \* |
| `hints`|Color::DarkGray.normal()| *| | `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.
``` ```
let config = { let config = {
color_config: { color_config: {
@ -281,7 +291,9 @@ let config = {
} }
} }
``` ```
Here's another small example using multiple color syntaxes with some comments. Here's another small example using multiple color syntaxes with some comments.
``` ```
let config = { let config = {
color_config: { color_config: {
@ -300,46 +312,46 @@ let config = {
} }
``` ```
## `FlatShape` values ## `Shape` values
As mentioned above, `flatshape` is a term used to indicate the sytax coloring. As mentioned above, `shape` 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 | default style | configurable | | shape | default style | configurable |
| - | - | - | | ---------------------------- | -------------------------------------- | ------------ |
| `flatshape_block`| fg(Color::Blue).bold()| * | | `shape_block` | fg(Color::Blue).bold() | \* |
| `flatshape_bool`| fg(Color::LightCyan)| * | | `shape_bool` | fg(Color::LightCyan) | \* |
| `flatshape_custom`| bold()| * | | `shape_custom` | bold() | \* |
| `flatshape_external`| fg(Color::Cyan)| * | | `shape_external` | fg(Color::Cyan) | \* |
| `flatshape_externalarg`| fg(Color::Green).bold()| * | | `shape_externalarg` | fg(Color::Green).bold() | \* |
| `flatshape_filepath`| fg(Color::Cyan)| * | | `shape_filepath` | fg(Color::Cyan) | \* |
| `flatshape_flag`| fg(Color::Blue).bold()| * | | `shape_flag` | fg(Color::Blue).bold() | \* |
| `flatshape_float`|fg(Color::Purple).bold() | * | | `shape_float` | fg(Color::Purple).bold() | \* |
| `flatshape_garbage`| fg(Color::White).on(Color::Red).bold()| * | | `shape_garbage` | fg(Color::White).on(Color::Red).bold() | \* |
| `flatshape_globpattern`| fg(Color::Cyan).bold()| * | | `shape_globpattern` | fg(Color::Cyan).bold() | \* |
| `flatshape_int`|fg(Color::Purple).bold() | * | | `shape_int` | fg(Color::Purple).bold() | \* |
| `flatshape_internalcall`| fg(Color::Cyan).bold()| * | | `shape_internalcall` | fg(Color::Cyan).bold() | \* |
| `flatshape_list`| fg(Color::Cyan).bold()| * | | `shape_list` | fg(Color::Cyan).bold() | \* |
| `flatshape_literal`| fg(Color::Blue)| * | | `shape_literal` | fg(Color::Blue) | \* |
| `flatshape_nothing`| fg(Color::LightCyan)| * | | `shape_nothing` | fg(Color::LightCyan) | \* |
| `flatshape_operator`| fg(Color::Yellow)| * | | `shape_operator` | fg(Color::Yellow) | \* |
| `flatshape_range`| fg(Color::Yellow).bold()| * | | `shape_range` | fg(Color::Yellow).bold() | \* |
| `flatshape_record`| fg(Color::Cyan).bold()| * | | `shape_record` | fg(Color::Cyan).bold() | \* |
| `flatshape_signature`| fg(Color::Green).bold()| * | | `shape_signature` | fg(Color::Green).bold() | \* |
| `flatshape_string`| fg(Color::Green)| * | | `shape_string` | fg(Color::Green) | \* |
| `flatshape_string_interpolation`| fg(Color::Cyan).bold()| * | | `shape_string_interpolation` | fg(Color::Cyan).bold() | \* |
| `flatshape_table`| fg(Color::Blue).bold()| * | | `shape_table` | fg(Color::Blue).bold() | \* |
| `flatshape_variable`| fg(Color::Purple)| * | | `shape_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.
``` ```
let $config = { let $config = {
color_config: { color_config: {
flatshape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b} shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
flatshape_bool: green shape_bool: green
flatshape_int: { fg: "#0000ff" attr: b} shape_int: { fg: "#0000ff" attr: b}
} }
} }
``` ```
@ -348,12 +360,12 @@ let $config = {
The nushell prompt is configurable through these environment variables settings. The nushell prompt is configurable through these environment variables settings.
* `PROMPT_COMMAND`: Code to execute for setting up the prompt (block) - `PROMPT_COMMAND`: Code to execute for setting up the prompt (block)
* `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_NORMAL` = "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`.
@ -367,7 +379,7 @@ Coloring of the prompt is controlled by the `block` in `PROMPT_COMMAND` where yo
## `LS_COLORS` colors for the `ls` command ## `LS_COLORS` colors for the `ls` command
Nushell will respect and use the `LS_COLORS` environment variable setting on Mac, Linux, and Windows. This setting allows you to define the color of file types when you do a `ls`. For instance, you can make directories one color, *.md markdown files another color, *.toml files yet another color, etc. There are a variety of ways to color your file types. Nushell will respect and use the `LS_COLORS` environment variable setting on Mac, Linux, and Windows. This setting allows you to define the color of file types when you do a `ls`. For instance, you can make directories one color, _.md markdown files another color, _.toml files yet another color, etc. There are a variety of ways to color your file types.
There's an exhaustive list [here](https://github.com/trapd00r/LS_COLORS), which is overkill, but gives you an rudimentary understanding of how to create a ls_colors file that `dircolors` can turn into a `LS_COLORS` environment variable. There's an exhaustive list [here](https://github.com/trapd00r/LS_COLORS), which is overkill, but gives you an rudimentary understanding of how to create a ls_colors file that `dircolors` can turn into a `LS_COLORS` environment variable.
@ -381,7 +393,7 @@ I like the `vivid` application and currently have it configured in my `config.nu
Theming combines all the coloring above. Here's a quick example of one we put together quickly to demonstrate the ability to theme. This is a spin on the `base16` themes that we see so widespread on the web. Theming combines all the coloring above. Here's a quick example of one we put together quickly to demonstrate the ability to theme. This is a spin on the `base16` themes that we see so widespread on the web.
The key to making theming work is to make sure you specify all themes and colors you're going to use in the `config.nu` file *before* you declare the `let config = ` line. The key to making theming work is to make sure you specify all themes and colors you're going to use in the `config.nu` file _before_ you declare the `let config = ` line.
``` ```
# lets define some colors # lets define some colors
@ -423,25 +435,25 @@ let base16_theme = {
cellpath: $base08 cellpath: $base08
hints: dark_gray hints: dark_gray
# flatshape_garbage: { fg: $base07 bg: $base08 attr: b} # base16 white on red # shape_garbage: { fg: $base07 bg: $base08 attr: b} # base16 white on red
# but i like the regular white on red for parse errors # but i like the regular white on red for parse errors
flatshape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b} shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
flatshape_bool: $base0d shape_bool: $base0d
flatshape_int: { fg: $base0e attr: b} shape_int: { fg: $base0e attr: b}
flatshape_float: { fg: $base0e attr: b} shape_float: { fg: $base0e attr: b}
flatshape_range: { fg: $base0a attr: b} shape_range: { fg: $base0a attr: b}
flatshape_internalcall: { fg: $base0c attr: b} shape_internalcall: { fg: $base0c attr: b}
flatshape_external: $base0c shape_external: $base0c
flatshape_externalarg: { fg: $base0b attr: b} shape_externalarg: { fg: $base0b attr: b}
flatshape_literal: $base0d shape_literal: $base0d
flatshape_operator: $base0a shape_operator: $base0a
flatshape_signature: { fg: $base0b attr: b} shape_signature: { fg: $base0b attr: b}
flatshape_string: $base0b shape_string: $base0b
flatshape_filepath: $base0d shape_filepath: $base0d
flatshape_globpattern: { fg: $base0d attr: b} shape_globpattern: { fg: $base0d attr: b}
flatshape_variable: $base0e shape_variable: $base0e
flatshape_flag: { fg: $base0d attr: b} shape_flag: { fg: $base0d attr: b}
flatshape_custom: {attr: b} shape_custom: {attr: b}
} }
# now let's apply our regular config settings but also apply the "color_config:" theme that we specified above. # now let's apply our regular config settings but also apply the "color_config:" theme that we specified above.
@ -462,4 +474,5 @@ let config = {
log_level: error log_level: error
} }
``` ```
if you want to go full-tilt on theming, you'll want to theme all the items I mentioned at the very beginning, including LS_COLORS, and the prompt. Good luck!
if you want to go full-tilt on theming, you'll want to theme all the items I mentioned at the very beginning, including LS_COLORS, and the prompt. Good luck!

View File

@ -132,30 +132,30 @@ let default_theme = {
block: white block: white
hints: dark_gray hints: dark_gray
# flatshapes are used to change the cli syntax highlighting # shapes are used to change the cli syntax highlighting
flatshape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b} shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
flatshape_bool: light_cyan shape_bool: light_cyan
flatshape_int: purple_bold shape_int: purple_bold
flatshape_float: purple_bold shape_float: purple_bold
flatshape_range: yellow_bold shape_range: yellow_bold
flatshape_internalcall: cyna_bold shape_internalcall: cyna_bold
flatshape_external: cyan shape_external: cyan
flatshape_externalarg: green_bold shape_externalarg: green_bold
flatshape_literal: blue shape_literal: blue
flatshape_operator: yellow shape_operator: yellow
flatshape_signature: green_bold shape_signature: green_bold
flatshape_string: green shape_string: green
flatshape_string_interpolation: cyan_bold shape_string_interpolation: cyan_bold
flatshape_list: cyan_bold shape_list: cyan_bold
flatshape_table: blue_bold shape_table: blue_bold
flatshape_record: cyan_bold shape_record: cyan_bold
flatshape_block: blue_bold shape_block: blue_bold
flatshape_filepath: cyan shape_filepath: cyan
flatshape_globpattern: cyan_bold shape_globpattern: cyan_bold
flatshape_variable: purple shape_variable: purple
flatshape_flag: blue_bold shape_flag: blue_bold
flatshape_custom: green shape_custom: green
flatshape_nothing: light_cyan shape_nothing: light_cyan
} }
# The default config record. This is where much of your global configuration is setup. # The default config record. This is where much of your global configuration is setup.