#style #match #pattern #color #effect #terminal #regex

app chromazone

chromazone is a line-oriented match and colorization tool

2 stable releases

1.0.1 Mar 19, 2024
1.0.0 Mar 17, 2024

#28 in Configuration

Download history 42/week @ 2024-03-11 240/week @ 2024-03-18 41/week @ 2024-04-01

323 downloads per month

MIT license

33KB
329 lines

chromazone (cz) 🎨

Chromazone is a banger tune by Mike Stern and a terminal colorizer.

Why not colorizer or pipecolor? Because it features

  • 📦️ fewest dependencies (two: regex and owo-colors)
  • 📈 fewest memory allocations
  • ✨ most color and effect combinations
  • 📝 arguably the simplest configuration format

CHANGELOG

See the CHANGELOG for a release history.

Usage

For one-off uses, pipe some output into to the cz binary and pass regex patterns and corresponding color and effect descriptions with the -m or --match argument like so

cat README.md | cz -m "\[[^\[]*\]" red,underline -m "^# .*$" yellow,bold

which should give the following output

To re-use style definitions, create a $HOME/.config/chromazone/chromazone.styles configuration file and specify sections for each style containing one or more match patterns and style descriptions like this

[diff]
"^@@.*@@$" yellow
"^-.*" red
"^+.*" green

The style can then specified with the -s or --style argument

diff Cargo.toml Cargo.lock | cz -s diff

Note that you can still extend given styles with additional -m arguments.

Style descriptions

Style descriptions are comma-separated lists of foreground colors (black, blue, cyan, green, magenta, purple, red, white and yellow), background colors (b:black, b:blue, b:cyan, b:green, b:magenta, b:purple, b:red, b:white and b:yellow) and effects (bold, italic, underline and strike).

Installation

For now you need a Rust toolchain and install it via cargo:

cargo install chromazone

License

MIT

Dependencies

~2.3–3.5MB
~56K SLoC