Skip to content

Instantly share code, notes, and snippets.

@faizzed
Created April 10, 2020 12:09
Show Gist options
  • Save faizzed/2f2095860c5e5134c603ba2c9c8a44b4 to your computer and use it in GitHub Desktop.
Save faizzed/2f2095860c5e5134c603ba2c9c8a44b4 to your computer and use it in GitHub Desktop.
Color print text in console
#!/usr/bin/env bash
END='\e[0m';
BOLD='\e[1m';
DIM='\e[2m';
ITALIC='\e[3m';
UNDERLING='\e[4m';
BLINK='\e[5m';
GHOST='\e[8m';
STRIKE_THROUGH='\e[9m';
DOUBLE_UNDER_LINE='\e[21m';
RED='\e[31m';
GREEN='\e[32m';
YELLOW='\e[33m';
BLUE='\e[34m';
PINK='\e[35m';
NEON='\e[36m';
WHITE='\e[37m';
BACKGROUND_GREY='\e[40m';
BACKGROUND_RED='\e[41m';
BACKGROUND_GREEN='\e[42m';
BACKGROUND_YELLOW='\e[43m';
BACKGROUND_BLUE='\e[44m';
BACKGROUND_PINK='\e[45m';
BACKGROUND_NEON='\e[46m';
BACKGROUND_WHITE='\e[47m';
function printGreen() {
printf "${GREEN}${1}${END}\n"
}
function printRed() {
printf "${RED}${1}${END}\n"
}
function printYellow() {
printf "${YELLOW}${1}${END}\n"
}
# and more
# printGreen "Hello world"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment