Skip to content

Instantly share code, notes, and snippets.

@raultm
Created June 16, 2017 07:17
Show Gist options
  • Save raultm/c68dca2d076273f569b51653503ead05 to your computer and use it in GitHub Desktop.
Save raultm/c68dca2d076273f569b51653503ead05 to your computer and use it in GitHub Desktop.
Bash Styling
#!/bin/bash
RESTORE=$(echo -en '\033[0m')
# \033[STYLE;COLORm OR \033[STYLE;BGCOLOR;COLORm
# STYLES 01:BOLD; 02:LIGHT; 03:???; 04:UNDERLINE; 05:???; 06:INVERSE
RED=$(echo -en '\033[00;31m')
GREEN=$(echo -en '\033[00;32m')
YELLOW=$(echo -en '\033[00;33m')
BLUE=$(echo -en '\033[00;34m')
MAGENTA=$(echo -en '\033[00;35m')
PURPLE=$(echo -en '\033[00;35m')
CYAN=$(echo -en '\033[00;36m')
h1style=$(echo -en '\033[01;44;33m')
h2style=$(echo -en '\033[00;44;33m')
h3style=$(echo -en '\033[02;44;33m')
listyle=$(echo ${RESTORE})
titlestyle=$(echo -en '\033[04;33m')
infostyle=$(echo ${BLUE})
successstyle=$(echo ${GREEN})
warningstyle=$(echo ${RESTORE})
dangerstyle=$(echo ${RED})
function h1 {
echo "${h1style}$1${RESTORE}"
}
function h2 {
echo "${h2style}$1${RESTORE}"
}
function h3 {
echo "${h3style}$1${RESTORE}"
}
function li {
echo "${listyle}$1${RESTORE}"
}
function title {
echo "${titlestyle}$1${RESTORE}"
}
function info {
echo "${infostyle}$1${RESTORE}"
}
function warning {
echo "${warningstyle}$1${RESTORE}"
}
function success {
echo "${successstyle}✔ $1${RESTORE}"
}
function danger {
echo "${dangerstyle}✘ $1${RESTORE}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment