@@ -322,47 +322,39 @@ This is the current list of primitives. Not all of these are configurable. The c
322
322
Here's a small example of changing some of these values.
323
323
324
324
``` nu
325
- let config = {
326
- color_config: {
327
- separator: purple
328
- leading_trailing_space_bg: "#ffffff"
329
- header: gb
330
- date: wd
331
- filesize: c
332
- row_index: cb
333
- bool: red
334
- int: green
335
- duration: blue_bold
336
- range: purple
337
- float: red
338
- string: white
339
- nothing: red
340
- binary: red
341
- cellpath: cyan
342
- hints: dark_gray
343
- }
344
- }
325
+ $env.config.color_config.separator = purple
326
+ $env.config.color_config.leading_trailing_space_bg = "#ffffff"
327
+ $env.config.color_config.header = gb
328
+ $env.config.color_config.date = wd
329
+ $env.config.color_config.filesize = c
330
+ $env.config.color_config.row_index = cb
331
+ $env.config.color_config.bool = red
332
+ $env.config.color_config.int = green
333
+ $env.config.color_config.duration = blue_bold
334
+ $env.config.color_config.range = purple
335
+ $env.config.color_config.float = red
336
+ $env.config.color_config.string = white
337
+ $env.config.color_config.nothing = red
338
+ $env.config.color_config.binary = red
339
+ $env.config.color_config.cellpath = cyan
340
+ $env.config.color_config.hints = dark_gray
345
341
```
346
342
347
343
Here's another small example using multiple color syntaxes with some comments.
348
344
349
345
``` nu
350
- let config = {
351
- color_config: {
352
- separator: "#88b719" # this sets only the foreground color like PR #486
353
- leading_trailing_space_bg: white # this sets only the foreground color in the original style
354
- header: { # this is like PR #489
355
- fg: "#B01455", # note, quotes are required on the values with hex colors
356
- bg: "#ffb900", # note, commas are not required, it could also be all on one line
357
- attr: bli # note, there are no quotes around this value. it works with or without quotes
358
- }
359
- date: "#75507B"
360
- filesize: "#729fcf"
361
- row_index: {
362
- # note, that this is another way to set only the foreground, no need to specify bg and attr
363
- fg: "#e50914"
364
- }
365
- }
346
+ $env.config.color_config.separator = "#88b719" # this sets only the foreground color like PR #486
347
+ $env.config.color_config.leading_trailing_space_bg = white # this sets only the foreground color in the original style
348
+ $env.config.color_config.header = { # this is like PR #489
349
+ fg: "#B01455", # note, quotes are required on the values with hex colors
350
+ bg: "#ffb900", # note, commas are not required, it could also be all on one line
351
+ attr: bli # note, there are no quotes around this value. it works with or without quotes
352
+ }
353
+ $env.config.color_config.date = "#75507B"
354
+ $env.config.color_config.filesize = "#729fcf"
355
+ $env.config.color_config.row_index = {
356
+ # note, that this is another way to set only the foreground, no need to specify bg and attr
357
+ fg: "#e50914"
366
358
}
367
359
```
368
360
@@ -390,6 +382,7 @@ Here's the current list of flat shapes.
390
382
| ` shape_literal ` | fg(Color::Blue) | \* |
391
383
| ` shape_nothing ` | fg(Color::LightCyan) | \* |
392
384
| ` shape_operator ` | fg(Color::Yellow) | \* |
385
+ | ` shape_pipe ` | fg(Color::Purple).bold() | \* |
393
386
| ` shape_range ` | fg(Color::Yellow).bold() | \* |
394
387
| ` shape_record ` | fg(Color::Cyan).bold() | \* |
395
388
| ` shape_signature ` | fg(Color::Green).bold() | \* |
@@ -398,16 +391,12 @@ Here's the current list of flat shapes.
398
391
| ` shape_table ` | fg(Color::Blue).bold() | \* |
399
392
| ` shape_variable ` | fg(Color::Purple) | \* |
400
393
401
- Here's a small example of how to apply color to these items. Anything not specified will receive the default color.
394
+ Here's a small example of how to apply color to these items. Anything not overidden will receive its default color.
402
395
403
396
``` nu
404
- $env.config = {
405
- color_config: {
406
- shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
407
- shape_bool: green
408
- shape_int: { fg: "#0000ff" attr: b}
409
- }
410
- }
397
+ $env.config.color_config.shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
398
+ $env.config.color_config.shape_bool: green
399
+ $env.config.color_config.shape_int: { fg: "#0000ff" attr: b}
411
400
```
412
401
413
402
## Prompt Configuration and Coloring
@@ -437,10 +426,7 @@ $env.PROMPT_INDICATOR = "> "
437
426
If 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:
438
427
439
428
``` nu
440
- config {
441
- render_right_prompt_on_last_line = true
442
- ...
443
- }
429
+ $env.config.render_right_prompt_on_last_line = true
444
430
```
445
431
446
432
Coloring 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 ) .
@@ -553,44 +539,42 @@ let base16_theme = {
553
539
cellpath: $base08
554
540
hints: dark_gray
555
541
556
- # shape_garbage: { fg: $base07 bg: $base08 attr: b} # base16 white on red
542
+ # shape_garbage: { fg: $base07 bg: $base08 attr: b } # base16 white on red
557
543
# but i like the regular white on red for parse errors
558
- shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
544
+ shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b }
559
545
shape_bool: $base0d
560
- shape_int: { fg: $base0e attr: b}
561
- shape_float: { fg: $base0e attr: b}
562
- shape_range: { fg: $base0a attr: b}
563
- shape_internalcall: { fg: $base0c attr: b}
546
+ shape_int: { fg: $base0e attr: b }
547
+ shape_float: { fg: $base0e attr: b }
548
+ shape_range: { fg: $base0a attr: b }
549
+ shape_internalcall: { fg: $base0c attr: b }
564
550
shape_external: $base0c
565
- shape_externalarg: { fg: $base0b attr: b}
551
+ shape_externalarg: { fg: $base0b attr: b }
566
552
shape_literal: $base0d
567
553
shape_operator: $base0a
568
- shape_signature: { fg: $base0b attr: b}
554
+ shape_signature: { fg: $base0b attr: b }
569
555
shape_string: $base0b
570
556
shape_filepath: $base0d
571
- shape_globpattern: { fg: $base0d attr: b}
557
+ shape_globpattern: { fg: $base0d attr: b }
572
558
shape_variable: $base0e
573
- shape_flag: { fg: $base0d attr: b}
574
- shape_custom: {attr: b}
559
+ shape_flag: { fg: $base0d attr: b }
560
+ shape_custom: { attr: b }
575
561
}
576
562
577
563
# now let's apply our regular config settings but also apply the "color_config:" theme that we specified above.
578
564
579
- let config = {
580
- filesize_metric: true
581
- table_mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other
582
- use_ls_colors: true
583
- color_config: $base16_theme # <-- this is the theme
584
- use_grid_icons: true
585
- footer_mode: always #always, never, number_of_rows, auto
586
- animate_prompt: false
587
- float_precision: 2
588
- use_ansi_coloring: true
589
- filesize_format: "b" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, auto
590
- edit_mode: emacs # vi
591
- max_history_size: 10000
592
- log_level: error
593
- }
565
+ $env.config.animate_prompt: false
566
+ $env.config.color_config: $base16_theme # <-- this is the theme
567
+ $env.config.edit_mode: emacs # vi
568
+ $env.config.filesize_format: "b" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, auto
569
+ $env.config.filesize_metric: true
570
+ $env.config.float_precision: 2
571
+ $env.config.footer_mode: always #always, never, number_of_rows, auto
572
+ $env.config.log_level: error
573
+ $env.config.max_history_size: 10000
574
+ $env.config.table_mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other
575
+ $env.config.use_ansi_coloring: true
576
+ $env.config.use_grid_icons: true
577
+ $env.config.use_ls_colors: true
594
578
```
595
579
596
580
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!
0 commit comments