Mercurial > ec-dotfiles
diff bin/termcolors.sh @ 144:1783152a1fe6
Color template for bash.
author | Edho Arief <edho@myconan.net> |
---|---|
date | Sun, 02 Oct 2011 04:17:53 +0700 |
parents | |
children | c3ca45204c4e |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/termcolors.sh Sun Oct 02 04:17:53 2011 +0700 @@ -0,0 +1,26 @@ +#!/bin/sh + +_c() { + color_name="${1}" + shift + text="${*}" + esq="\033[" + r="${esq}0m" # r for reset + case "${color_name}" in + bold_*) color="1;";; + *) color="0;";; + esac + case "${color_name}" in + *black) color="${color}30";; + *blue) color="${color}34";; + *green) color="${color}32";; + *cyan) color="${color}36";; + *red) color="${color}31";; + *purple) color="${color}35";; + *brown) color="${color}33";; + *gray) color="${color}37";; + esac + color="${esq}${color}m" + printf "${color}%s${r}" "${text}" +} +