A simple include file which allows you to add colour support to your bash scripts.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.gitignore
.travis.yml
CHANGELOG.md
CODEOWNERS
CONTRIBUTING.md
LICENSE.md
README.md
stale.yml

README.md

Build Status Software License Release Github commits (since latest release) GitHub repo size in bytes GitHub contributors

Bash Colour Include

bash-colour-include.sh

This is a simple script to create and export a set of variables which contain the 8 basic colours that can be displayed on most terminals. It could be extended to use more colours if wanted.

In addition it also creeates and export a set of variables which handle other specific useful terminal information, cls, bold, reset etc.

The idea is for it to be included by other scripts to allow for colour to be added to a script in a clean and simple way.

bash-colour-include-example.sh

This is a very simple (almost trivial) example of how to make use of the bash-colour-include script and embed colour simply into any given script.

Use the source

#!/usr/bin/env bash

source bash-colour-include.sh

echo "${bgBlack}${fgRed}This should be red text${reset}"
echo "${bgBlack}${fgYellow}This should be yellow text${reset}"
echo "${bgWhite}${fgRed}This should be red on a white background${reset}"