nu_plugin_ls_colorize

Crates.ionu_plugin_ls_colorize
lib.rsnu_plugin_ls_colorize
version1.0.1+0.109.1
created_at2025-10-09 23:59:19.700011+00
updated_at2026-01-08 04:21:11.478734+00
descriptionA plugin for Nushell that colorizes paths using LS_COLORS
homepage
repositoryhttps://github.com/brendon-felix/nu_plugin_ls_colorize
max_upload_size
id1876345
size84,159
Brendon Felix (brendon-felix)

documentation

README

nu_plugin_ls_colorize

Version

A simple plugin for Nushell which colorizes paths according to the builtin ls colors or the LS_COLORS environment variable (if set). In most cases, a colorized path should look the exact same as it would in ls or ls | grid -c when printed.

Installing

cargo install nu_plugin_ls_colorize
plugin add ~/.cargo/bin/nu_plugin_ls_colorize

Usage

Colorize a single path

let colorized = $env.PWD | ls-colorize
$colorized | debug -v
#
# "\u{1b}[38;5;81m/current/working/directory\u{1b}[0m"

Colorize a list of paths

cd nu_plugin_ls_colorize
let colorized = ls | get name | ls-colorize
$colorized | debug -v
#
# ╭──────────────────────────────────────────────╮
# │ "\u{1b}[38;5;243mCargo.lock\u{1b}[0m"        │
# │ "\u{1b}[38;5;149mCargo.toml\u{1b}[0m"        │
# │ "\u{1b}[38;5;249mLICENSE\u{1b}[0m"           │
# │ "\u{1b}[48;5;186;38;5;16mREADME.md\u{1b}[0m" │
# │ "\u{1b}[38;5;81msrc\u{1b}[0m"                │
# │ "\u{1b}[38;5;81mtarget\u{1b}[0m"             │
# ╰──────────────────────────────────────────────╯

Get ansi colors instead

cd nu_plugin_ls_colorize
ls | get name | ls-colorize --get-color
#
# ╭──────────────────┬─────────────────╮
# │        fg        │       bg        │
# ├──────────────────┼─────────────────┤
# │ grey46           │       ❎        │
# │ darkolivegreen3c │       ❎        │
# │ grey70           │       ❎        │
# │ grey0            │ lightgoldenrod2 │
# │ steelblue1b      │       ❎        │
# │ steelblue1b      │       ❎        │
# ╰──────────────────┴─────────────────╯

Get ansi colors for a custom LS_COLORS string generated using vivid

$env.LS_COLORS = (vivid generate zenburn)
cd nu_plugin_ls_colorize
ls | get name | ls-colorize --get-color
#
# ╭─────────┬─────────┬──────╮
# │   fg    │   bg    │ attr │
# ├─────────┼─────────┼──────┤
# │ #7e7e7e │   ❎    │  ❎  │
# │ #e8bc92 │   ❎    │  ❎  │
# │ #878787 │   ❎    │  ❎  │
# │ #393939 │ #e8bc92 │  ❎  │
# │ #70a2d1 │   ❎    │ u    │
# │ #70a2d1 │   ❎    │ u    │
# ╰─────────┴─────────┴──────╯
Commit count: 4

cargo fmt