'color' is a class like component to simplify the handling of ansi colors and keeps the color settings readable. A set NO_COLOR=1 will be respected.
Free software and open source.
👤 Author: Axel Hahn
📄 Source: https://github.com/axelhahn/bash_colorfunctions
📜 License: GNU GPL 3.0
📗 Docs: see https://www.axel-hahn.de/docs/bash_colorfunctions
Source this script:
. ./src/color.class.sh
and execute color.help
or read the docs :-)
Set a color. Every following command uses that color until you set a new one or reset it.
color.fg "blue"
ls -l
color.reset
Echo a single message in green and reset the color afterwards.
color.echo "green" "OK. I guess you got it."
To set a color you can use ansi code, color names (see table below) or rgb heccodes (like css color codes).