You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## `LS_COLORS` Colors for the [`ls`](/commands/docs/ls.md) Command
414
414
415
-
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`](/commands/docs/ls.md). 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.
415
+
Nushell will respect and use the `LS_COLORS` environment variable setting on Mac, Linux, and Windows. This setting allows you to define the coloring of file types when you do a [`ls`](/commands/docs/ls.md). 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 and style your file types.
416
416
417
-
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.
417
+
If `LS_COLORS`is not set, nushell will default to a built-in `LS_COLORS` setting, based on [8-bit (extended) ANSI colors](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit).
418
418
419
-
[This](https://www.linuxhowto.net/how-to-set-colors-for-ls-command/) is a pretty good introduction to `LS_COLORS`. I'm sure you can find many more tutorials on the web.
419
+
### Understanding `LS_COLORS`
420
420
421
-
I like the `vivid` application and currently have it configured in my `config.nu` like this. You can find `vivid`[here](https://github.com/sharkdp/vivid).
421
+
`LS_COLORS` contains a colon (`:`) separated list of records that map file types and file names to styling attributes (`selector=attributes`).
The selector can be a file type specified like `di` for "directory identifier", or `*.nu` for files with the `.nu` file extension.
424
424
425
-
If `LS_COLORS` is not set, nushell will default to a built-in `LS_COLORS` setting, based on 8-bit (extended) ANSI colors.
425
+
The attributes are a list of semicolon (`;`) separated numbers. Note that which attributes and attribute formats are supported depends on the terminal you are using.
`$env.LS_COLORS = "di=48;2;200;0;0;5"`: Red background blinking directories
438
+
439
+
### vivid Themes
440
+
441
+
For example, you can use the third-party tool [vivid](https://github.com/sharkdp/vivid), which runs on multiple platforms, has [many themes defined](https://github.com/sharkdp/vivid/tree/master/themes), and generates a `LS_COLORS` configuration from it.
442
+
443
+
After downloading and extracting the binary, you can use it with:
444
+
445
+
```nu
446
+
$env.LS_COLORS = (vivid generate molokai)
447
+
```
448
+
449
+
or with an alternative theme:
450
+
451
+
```nu
452
+
$env.LS_COLORS = (vivid generate ayu)
453
+
```
454
+
455
+
You can put this command into your [Nushell configuration](/book/configuration.md) for it to become the default coloring.
0 commit comments