chromazone

Crates.iochromazone
lib.rschromazone
version1.0.1
sourcesrc
created_at2024-03-17 21:14:11.953985
updated_at2024-03-19 13:16:52.108137
descriptionchromazone is a line-oriented match and colorization tool.
homepagehttps://github.com/matze/chromazone
repositoryhttps://github.com/matze/chromazone
max_upload_size
id1176822
size35,274
Matthias Vogelgesang (matze)

documentation

https://github.com/matze/chromazone

README

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

Commit count: 23

cargo fmt