@@ -324,47 +324,39 @@ This is the current list of primitives. Not all of these are configurable. The c
324324Here's a small example of changing some of these values.
325325
326326``` nu
327- let config = {
328- color_config: {
329- separator: purple
330- leading_trailing_space_bg: "#ffffff"
331- header: gb
332- date: wd
333- filesize: c
334- row_index: cb
335- bool: red
336- int: green
337- duration: blue_bold
338- range: purple
339- float: red
340- string: white
341- nothing: red
342- binary: red
343- cellpath: cyan
344- hints: dark_gray
345- }
346- }
327+ $env.config.color_config.separator = purple
328+ $env.config.color_config.leading_trailing_space_bg = "#ffffff"
329+ $env.config.color_config.header = gb
330+ $env.config.color_config.date = wd
331+ $env.config.color_config.filesize = c
332+ $env.config.color_config.row_index = cb
333+ $env.config.color_config.bool = red
334+ $env.config.color_config.int = green
335+ $env.config.color_config.duration = blue_bold
336+ $env.config.color_config.range = purple
337+ $env.config.color_config.float = red
338+ $env.config.color_config.string = white
339+ $env.config.color_config.nothing = red
340+ $env.config.color_config.binary = red
341+ $env.config.color_config.cellpath = cyan
342+ $env.config.color_config.hints = dark_gray
347343```
348344
349345Here's another small example using multiple color syntaxes with some comments.
350346
351347``` nu
352- let config = {
353- color_config: {
354- separator: "#88b719" # this sets only the foreground color like PR #486
355- leading_trailing_space_bg: white # this sets only the foreground color in the original style
356- header: { # this is like PR #489
357- fg: "#B01455", # note, quotes are required on the values with hex colors
358- bg: "#ffb900", # note, commas are not required, it could also be all on one line
359- attr: bli # note, there are no quotes around this value. it works with or without quotes
360- }
361- date: "#75507B"
362- filesize: "#729fcf"
363- row_index: {
364- # note, that this is another way to set only the foreground, no need to specify bg and attr
365- fg: "#e50914"
366- }
367- }
348+ $env.config.color_config.separator = "#88b719" # this sets only the foreground color like PR #486
349+ $env.config.color_config.leading_trailing_space_bg = white # this sets only the foreground color in the original style
350+ $env.config.color_config.header = { # this is like PR #489
351+ fg: "#B01455", # note, quotes are required on the values with hex colors
352+ bg: "#ffb900", # note, commas are not required, it could also be all on one line
353+ attr: bli # note, there are no quotes around this value. it works with or without quotes
354+ }
355+ $env.config.color_config.date = "#75507B"
356+ $env.config.color_config.filesize = "#729fcf"
357+ $env.config.color_config.row_index = {
358+ # note, that this is another way to set only the foreground, no need to specify bg and attr
359+ fg: "#e50914"
368360}
369361```
370362
@@ -392,6 +384,7 @@ Here's the current list of flat shapes.
392384| ` shape_literal ` | fg(Color::Blue) | \* |
393385| ` shape_nothing ` | fg(Color::LightCyan) | \* |
394386| ` shape_operator ` | fg(Color::Yellow) | \* |
387+ | ` shape_pipe ` | fg(Color::Purple).bold() | \* |
395388| ` shape_range ` | fg(Color::Yellow).bold() | \* |
396389| ` shape_record ` | fg(Color::Cyan).bold() | \* |
397390| ` shape_signature ` | fg(Color::Green).bold() | \* |
@@ -400,16 +393,12 @@ Here's the current list of flat shapes.
400393| ` shape_table ` | fg(Color::Blue).bold() | \* |
401394| ` shape_variable ` | fg(Color::Purple) | \* |
402395
403- Here's a small example of how to apply color to these items. Anything not specified will receive the default color.
396+ Here's a small example of how to apply color to these items. Anything not overridden will receive its default color.
404397
405398``` nu
406- $env.config = {
407- color_config: {
408- shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
409- shape_bool: green
410- shape_int: { fg: "#0000ff" attr: b}
411- }
412- }
399+ $env.config.color_config.shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
400+ $env.config.color_config.shape_bool: green
401+ $env.config.color_config.shape_int: { fg: "#0000ff" attr: b}
413402```
414403
415404## Prompt Configuration and Coloring
@@ -439,10 +428,7 @@ $env.PROMPT_INDICATOR = "> "
439428If you're using ` starship ` , you'll most likely want to show the right prompt on the last line of the prompt, just like zsh or fish. You could modify the ` config.nu ` file, just set ` render_right_prompt_on_last_line ` to true:
440429
441430``` nu
442- config {
443- render_right_prompt_on_last_line = true
444- ...
445- }
431+ $env.config.render_right_prompt_on_last_line = true
446432```
447433
448434Coloring of the prompt is controlled by the ` block ` in ` PROMPT_COMMAND ` where you can write your own custom prompt. We've written a slightly fancy one that has git statuses located in the [ nu_scripts repo] ( https://github.com/nushell/nu_scripts/blob/main/modules/prompt/oh-my.nu ) .
@@ -555,44 +541,42 @@ let base16_theme = {
555541 cellpath: $base08
556542 hints: dark_gray
557543
558- # shape_garbage: { fg: $base07 bg: $base08 attr: b} # base16 white on red
544+ # shape_garbage: { fg: $base07 bg: $base08 attr: b } # base16 white on red
559545 # but i like the regular white on red for parse errors
560- shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
546+ shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b }
561547 shape_bool: $base0d
562- shape_int: { fg: $base0e attr: b}
563- shape_float: { fg: $base0e attr: b}
564- shape_range: { fg: $base0a attr: b}
565- shape_internalcall: { fg: $base0c attr: b}
548+ shape_int: { fg: $base0e attr: b }
549+ shape_float: { fg: $base0e attr: b }
550+ shape_range: { fg: $base0a attr: b }
551+ shape_internalcall: { fg: $base0c attr: b }
566552 shape_external: $base0c
567- shape_externalarg: { fg: $base0b attr: b}
553+ shape_externalarg: { fg: $base0b attr: b }
568554 shape_literal: $base0d
569555 shape_operator: $base0a
570- shape_signature: { fg: $base0b attr: b}
556+ shape_signature: { fg: $base0b attr: b }
571557 shape_string: $base0b
572558 shape_filepath: $base0d
573- shape_globpattern: { fg: $base0d attr: b}
559+ shape_globpattern: { fg: $base0d attr: b }
574560 shape_variable: $base0e
575- shape_flag: { fg: $base0d attr: b}
576- shape_custom: {attr: b}
561+ shape_flag: { fg: $base0d attr: b }
562+ shape_custom: { attr: b }
577563}
578564
579565# now let's apply our regular config settings but also apply the "color_config:" theme that we specified above.
580566
581- let config = {
582- filesize_metric: true
583- table_mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other
584- use_ls_colors: true
585- color_config: $base16_theme # <-- this is the theme
586- use_grid_icons: true
587- footer_mode: always #always, never, number_of_rows, auto
588- animate_prompt: false
589- float_precision: 2
590- use_ansi_coloring: true
591- filesize_format: "b" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, auto
592- edit_mode: emacs # vi
593- max_history_size: 10000
594- log_level: error
595- }
567+ $env.config.animate_prompt: false
568+ $env.config.color_config: $base16_theme # <-- this is the theme
569+ $env.config.edit_mode: emacs # vi
570+ $env.config.filesize_format: "b" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, auto
571+ $env.config.filesize_metric: true
572+ $env.config.float_precision: 2
573+ $env.config.footer_mode: always #always, never, number_of_rows, auto
574+ $env.config.log_level: error
575+ $env.config.max_history_size: 10000
576+ $env.config.table_mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other
577+ $env.config.use_ansi_coloring: true
578+ $env.config.use_grid_icons: true
579+ $env.config.use_ls_colors: true
596580```
597581
598582if 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!
0 commit comments