Getting started

Source the script

In your shell script you need to source the file bash_colorfunctions/src/ Then you can use functions that have a bit a class like look and feel named color.[NAME].

Local script

You can source the file from the local installation.

. /opt/bash_colorfunctions/src/ || exit 1


From your script directory

If you want to deploy your script, you also can copy the single file into your directory.

cd [your directory of scripts]
cp /opt/bash_colorfunctions/src/ .

Then you can source it with a relative path

. $( dirname $0 )/ || exit 1

Keep in mind that this method is unhandy to update the

Start coloring

Let’s start with echo of a colored text:

color.echo "white" "green" "Yep, it seems to work!"

You also can initialize a wanted color. Then execute your commands that will drop their output in that color. Finally reset the color. As an example I set the foreground color (fg) to blue (ansi code 34):

color.fg "blue"
ls -l

You need an overview over all available functions and colors. See “All functions” and “Colors” on the left.


Remark: You can pause the video to read the lines of the demo and rewind too.