Skip to content

Instantly share code, notes, and snippets.

@lcaballero
Created November 8, 2016 18:37
Show Gist options
  • Save lcaballero/3778e9682b9b639717ee34b7c8dedb25 to your computer and use it in GitHub Desktop.
Save lcaballero/3778e9682b9b639717ee34b7c8dedb25 to your computer and use it in GitHub Desktop.
Simplistic way to add color to shell scripts in console output.
#!/usr/bin/env bash
red=31 ; green=32 ; brown=33 ; blue=34
purple=35 ; cyan=36 ; light_gray=37
function _a() {
echo -e -n "\033[$1m${@:2}\033[0m "
}
function _rd() {
_a $red $*
}
function _gr() {
_a $green $*
}
function _br() {
_a $brown $*
}
function _bl() {
_a $blue $*
}
function _pr() {
_a $purple $*
}
function _cy() {
_a $cyan $*
}
function _gy() {
_a $light_gray $*
}
function _n() {
echo -e ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment