ansi-escape-sequences-cli provides an executable called ansi which can be
used in a shell or in a shell script to easily colorize and style terminal
output.
- Add
ansito yourPATH - Embed it in your shell scripts like this:
# You need "-e" to let echo replace the escaped ESC symbol echo -e "$(ansi yellow bold)WARNING$(ansi reset): There was a problem" # Or use echo without "-e": echo "$(ansi yellow bold --escape-style=direct)WARNING$(ansi reset): There was a problem"
- Type
--helpfor more guidance!
$ cargo install ansi-escape-sequences-cli (the binary is just called ansi!)
- ✔️ Linux
- ✔️ MacOS
- ✔️ Windows
Ths MSRV is 1.85.1.