Skip to content

Instantly share code, notes, and snippets.

@rkumar
Created December 6, 2011 07:25
Show Gist options
  • Save rkumar/1437187 to your computer and use it in GitHub Desktop.
Save rkumar/1437187 to your computer and use it in GitHub Desktop.
colormap.sh - bash color mappings
export NONE=''
export BLACK='\\033[0;30m'
export RED='\\033[0;31m'
export GREEN='\\033[0;32m'
export BROWN='\\033[0;33m'
export BLUE='\\033[0;34m'
export PURPLE='\\033[0;35m'
export CYAN='\\033[0;36m'
export LIGHT_GREY='\\033[0;37m'
export DARK_GREY='\\033[1;30m'
export LIGHT_RED='\\033[1;31m'
export LIGHT_GREEN='\\033[1;32m'
export YELLOW='\\033[1;33m'
export LIGHT_BLUE='\\033[1;34m'
export LIGHT_PURPLE='\\033[1;35m'
export LIGHT_CYAN='\\033[1;36m'
export WHITE='\\033[1;37m'
export DEFAULT='\\033[0m'
export REVERSE='\\033[7m'
export RESET='\\033[0m'
export UNDERLINE='\\033[4m'
export DIM='\\033[2m'
export BLINK='\\033[5m'
export UL=$UNDERLINE
# Set the terminal's background ANSI color to black.
export ON_BLACK='\\033[40m'
# Set the terminal's background ANSI color to red.
export ON_RED='\\033[41m'
# Set the terminal's background ANSI color to green.
export ON_GREEN='\\033[42m'
# Set the terminal's background ANSI color to yellow.
export ON_YELLOW='\\033[43m'
# Set the terminal's background ANSI color to blue.
export ON_BLUE='\\033[44m'
# Set the terminal's background ANSI color to magenta.
export ON_MAGENTA='\\033[45m'
# Set the terminal's background ANSI color to cyan.
export ON_CYAN='\\033[46m'
# Set the terminal's background ANSI color to white.
export ON_WHITE='\\033[47m'
export ON_BLUE='\\033[44m'
export ON_GRAY232='\\033[48;5;232m'
export ON_GRAY233='\\033[48;5;233m'
export ON_GRAY234='\\033[48;5;234m'
export ON_GRAY235='\\033[48;5;235m'
export ON_GRAY236='\\033[48;5;236m'
# Default priority->color map.
export PRI_A=$YELLOW # color for A priority
export PRI_B=$GREEN # color for B priority
export PRI_C=$CYAN # color for C priority
export PRI_X=$WHITE # color for rest of them
# if you want 256 colors in bash use params 0 - 255
# function EXT_COLOR () { echo -ne "\\033[38;5;$1m"; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment