How to Install and Use vivid in Linux to Customise LS_COLORS and File Highlighting

Modern terminal workflows thrive on visual clarity. When navigating deep directory trees or reviewing complex project structures, default terminal file listings often render files in illegible shades of blue, harsh greens, or generic monochrome text. The standard method for styling terminal file listings involves configuring the LS_COLORS environment variable, a notoriously cryptic string of colon-separated file extensions and ANSI escape codes. vivid is an open-source, themeable LS_COLORS generator written in Rust that simplifies file colour customisation. It provides dozens of expertly crafted colour palettes and automatically generates the precise export strings required by modern shells and tools such as ls, tree, fd, and eza.

Why Use vivid for Terminal File Highlighting?

Configuring terminal highlighting manually requires calculating 8-bit or 24-bit ANSI colour sequences for dozens of individual extensions, MIME categories, socket types, symlinks, and directory permissions. Vivid completely abstracts this complexity:

  • Curated Colour Palettes: Ships with out-of-the-box support for popular developer themes, including Catppuccin, Dracula, Gruvbox, Nord, Solarized, OneDark, and TokyoNight.
  • Truecolor (24-bit) and 8-bit Support: Generates crisp 24-bit truecolor definitions for modern terminal emulators (such as Alacritty, Kitty, WezTerm, and Ghostty) alongside fallback 8-bit ANSI profiles for legacy consoles.
  • Extensive Filetype Database: Categorises archives, media files, temporary files, configuration formats, cryptographic certificates, build artefacts, and programming source files with distinct hues.
  • Broad Tool Compatibility: In addition to standard GNU ls, the generated LS_COLORS variable is natively respected by modern CLI alternatives such as fd, eza, and shell completion menus in Zsh and Fish.

How to Install vivid in Linux

Vivid is packaged across most major Linux distributions and can also be installed via Cargo or pre-compiled release binaries.

Method 1: Install via Native Package Managers

On Debian, Ubuntu, and derivatives (Ubuntu 24.04 LTS and newer), install Vivid directly through APT:

sudo apt update && sudo apt install vivid

On Arch Linux and Manjaro, Vivid is available in the official extra repository:

sudo pacman -S vivid

On Fedora and Red Hat Enterprise Linux:

sudo dnf install vivid

On openSUSE Tumbleweed or Leap:

sudo zypper install vivid

Method 2: Install via Cargo (Rust Toolchain)

If your distribution repositories provide an older build, install the latest upstream release using Cargo:

cargo install vivid

How to Preview and Select Themes in vivid

Vivid includes a built-in preview and listing mechanism so you can inspect available colour schemes directly inside your active terminal window.

  1. List all available built-in themes by executing:
    vivid themes
    You will see popular themes such as catppuccin-mocha, dracula, gruvbox-dark, nord, snazzy, and tokyonight-night.
  2. Preview how a specific theme renders different file categories by generating an output sample:
    vivid preview dracula
    Vivid will print a formatted table displaying directories, symlinks, executable binaries, images, videos, audio tracks, compressed archives, and source code files styled according to the selected palette.
  3. Compare light and dark variants to match your terminal emulator’s background:
    vivid preview solarized-dark
    vivid preview solarized-light

How to Configure Your Shell to Apply vivid LS_COLORS Automatically

To ensure your terminal file listings remain styled across all future terminal sessions, export the generated LS_COLORS variable within your shell’s configuration file.

For Bash Users (~/.bashrc)

Open your Bash configuration file in your preferred text editor:

nano ~/.bashrc

Append the following line at the end of the file, replacing catppuccin-mocha with your preferred theme:

# Apply vivid theme to LS_COLORS
export LS_COLORS="$(vivid generate catppuccin-mocha)"

Save the file (Ctrl + O, then Enter) and exit (Ctrl + X). Reload the configuration into your active shell:

source ~/.bashrc

For Zsh Users (~/.zshrc)

Open your Zsh configuration:

nano ~/.zshrc

Add the export line along with completion styling:

# Apply vivid theme to LS_COLORS and completion lists
export LS_COLORS="$(vivid generate dracula)"
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"

Save and reload your Zsh environment:

source ~/.zshrc

For Fish Users (~/.config/fish/config.fish)

For Fish shell users, define the environment variable inside config.fish:

set -gx LS_COLORS (vivid generate nord)

Optimising Performance for Fast Shell Startup

Running vivid generate <theme> synchronously each time a new terminal tab opens introduces a tiny sub-millisecond execution overhead. If you prioritise instantaneous sub-shell launches, pre-generate your colour string into a static cache file:

  1. Generate and save the static colour definition file:
    vivid generate catppuccin-mocha > ~/.config/ls_colors_theme
  2. Update your ~/.bashrc or ~/.zshrc to read the cached file instead of spawning a new process:
    export LS_COLORS="$(cat ~/.config/ls_colors_theme)"

Whenever you choose to switch colour palettes in the future, simply re-run the vivid generate command redirected to that cache path.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.