Last active
June 28, 2017 20:07
-
-
Save bsdshell/1fe0da20068e6f6e7a93f156677faced to your computer and use it in GitHub Desktop.
shell color shell script color console color
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Colours and font styles | |
## Syntax: echo -e "${FOREGROUND_COLOUR}${BACKGROUND_COLOUR}${STYLE}Hello world!${RESET_ALL}" | |
# Escape sequence and resets | |
ESC_SEQ="\e[0;" | |
RESET_ALL="${ESC_SEQ}0m" | |
RESET_BOLD="${ESC_SEQ}21m" | |
RESET_UL="${ESC_SEQ}24m" | |
# Foreground colours | |
FG_BLACK="${ESC_SEQ}30m" | |
FG_RED="${ESC_SEQ}31m" | |
FG_GREEN="${ESC_SEQ}32m" | |
FG_YELLOW="${ESC_SEQ}33m" | |
FG_BLUE="${ESC_SEQ}34m" | |
FG_MAGENTA="${ESC_SEQ}35m" | |
FG_CYAN="${ESC_SEQ}36m" | |
FG_WHITE="${ESC_SEQ}37m" | |
FG_BR_BLACK="${ESC_SEQ}90m" | |
FG_BR_RED="${ESC_SEQ}91m" | |
FG_BR_GREEN="${ESC_SEQ}92m" | |
FG_BR_YELLOW="${ESC_SEQ}93m" | |
FG_BR_BLUE="${ESC_SEQ}94m" | |
FG_BR_MAGENTA="${ESC_SEQ}95m" | |
FG_BR_CYAN="${ESC_SEQ}96m" | |
FG_BR_WHITE="${ESC_SEQ}97m" | |
# Background colours (optional) | |
BG_BLACK="${ESC_SEQ}40m" | |
BG_RED="${ESC_SEQ}41m" | |
BG_GREEN="${ESC_SEQ}42m" | |
BG_YELLOW="${ESC_SEQ}43m" | |
BG_BLUE="${ESC_SEQ}44m" | |
BG_MAGENTA="${ESC_SEQ}45m" | |
BG_CYAN="${ESC_SEQ}46m" | |
BG_WHITE="${ESC_SEQ}47m" | |
# Font styles | |
FS_REG="0m" | |
FS_BOLD="1m" | |
FS_UL="4m" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment