8 releases (breaking)

0.10.1 Jun 22, 2024
0.10.0 Jun 22, 2024
0.9.0 Mar 14, 2023
0.8.0 Jan 29, 2022
0.4.0 Dec 3, 2018

#7 in Command line utilities

Download history 57/week @ 2024-08-15 60/week @ 2024-08-22 57/week @ 2024-08-29 37/week @ 2024-09-05 82/week @ 2024-09-12 68/week @ 2024-09-19 92/week @ 2024-09-26 72/week @ 2024-10-03 64/week @ 2024-10-10 56/week @ 2024-10-17 42/week @ 2024-10-24 47/week @ 2024-10-31 49/week @ 2024-11-07 67/week @ 2024-11-14 51/week @ 2024-11-21 46/week @ 2024-11-28

217 downloads per month

MIT/Apache and LGPL-3.0-or-later

38KB
777 lines

vivid

CICD Crates.io

vivid is a generator for the LS_COLORS environment variable that controls the colorized output of ls, tree, fd, bfs, dust and many other tools.

It uses a YAML configuration format for the filetype-database and the color themes. In contrast to dircolors, the database and the themes are organized in different files. This allows users to choose and customize color themes independent from the collection of file extensions. Instead of using cryptic ANSI escape codes, colors can be specified in the RRGGBB format and will be translated to either truecolor (24-bit) ANSI codes or 8-bit codes for older terminal emulators.

Preview

snazzy molokai ayu
snazzy theme molokai theme ayu theme
lava
lava

Usage

Choose a color theme (for example: molokai). Then, add this to your shells RC file (~/.bashrc, ~/.zshrc, …):

export LS_COLORS="$(vivid generate molokai)"

Theme preview

To try all available themes with your current directory:

for theme in $(vivid themes); do
    echo "Theme: $theme"
    LS_COLORS=$(vivid generate $theme)
    ls
    echo
done

Terminals without true color support

By default, vivid runs in true color mode (24-bit). If you don't have a terminal that supports 24-bit colors, use the --color-mode 8-bit option when running vivid. This will generate interpolated 8-bit colors:

export LS_COLORS="$(vivid -m 8-bit generate molokai)"

Customization

Custom filetypes.yml databases can be placed in /usr/share/vivid, $HOME/.config/vivid, or $XDG_CONFIG_HOME/vivid on POSIX systems, or in %APPDATA%\vivid on Windows systems.

Custom color themes go into a themes subfolder, respectively. You can also specify an explicit path to your custom theme: vivid generate path/to/my_theme.yml. As a starting point, you can use one of the bundled themes.

Installation

On Debian-based systems

Download one of the Debian packages from the release page and install it via dpkg -i:

wget "https://github.com/sharkdp/vivid/releases/download/v0.8.0/vivid_0.8.0_amd64.deb"
sudo dpkg -i vivid_0.8.0_amd64.deb

On Arch Linux

You can install vivid from the official package repository:

pacman -S vivid

On Gentoo Linux

You can install vivid from GURU Overlay

emerge vivid

On FreeBSD

You can install vivid from the FreeBSD Ports Collection:

pkg install vivid

On macOS

You can install vivid from Homebrew:

brew install vivid

Note that the BSD version of ls does not use LS_COLORS, but you can use the GNU version of ls instead:

brew install coreutils
alias ls="gls --color"

On other distributions

Check out the release page for binary builds.

From source

If you have Rust 1.54 or higher, you can install vivid from source via cargo:

cargo install vivid

License

Licensed under either of

at your option.

Useful resources

File types:

ANSI colors:

Similar and related projects:

Dependencies

~4–13MB
~161K SLoC