Skip to content

Instantly share code, notes, and snippets.

@dotCipher
Last active August 29, 2015 14:12
Show Gist options
  • Save dotCipher/bcf050f39c160c31222f to your computer and use it in GitHub Desktop.
Save dotCipher/bcf050f39c160c31222f to your computer and use it in GitHub Desktop.
A quick snippet for displaying text in a certain color in bash
#!/bin/bash
BLACK='\033[0;30m'
DARK_GRAY='\033[1;30m'
BLUE='\033[0;34m'
LIGHT_BLUE='\033[1;34m'
GREEN='\033[0;32m'
LIGHT_GREEN='\033[1;32m'
CYAN='\033[0;36m'
LIGHT_CYAN='\033[1;36m'
RED='\033[0;31m'
LIGHT_RED='\033[1;31m'
PURPLE='\033[0;35m'
LIGHT_PURPLE='\033[1;35m'
ORANGE='\033[0;33m'
YELLOW='\033[1;33m'
LIGHT_GRAY='\033[0;37m'
WHITE='\033[1;37m'
NO_COLOR='\033[0m'
# Params: (<func> $1 $2 $3 ...etc)
# $1 = Color to make text
# $2 = Text output
# Description:
# Echoes the text given in the given color
echoColor() {
# Include color termination at the EOL
COLORED_STRING="$1$2${NO_COLOR}"
echo -e $COLORED_STRING
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment