Last active
March 18, 2024 08:43
-
-
Save grahamhelton/3c9a1e3184de209cf505fa83444ac5f5 to your computer and use it in GitHub Desktop.
Bash colors template
This file contains 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
#! /bin/bash | |
# NOTE: To make use of a wider color pallet set the TERM enviornment variable TERM=xterm-256color | |
# Colors | |
BOLD=$(tput bold) | |
NOCOLOR=$(tput sgr0) | |
RED=$(tput setaf 1) | |
GREEN=$(tput setaf 2) | |
YELLOW=$(tput setaf 3) | |
BLUE=$(tput setaf 4) | |
PURPLE=$(tput setaf 5) | |
CYAN=$(tput setaf 6) | |
WHITE=$(tput setaf 7) | |
BLACK=$(tput setaf 8) | |
BG_YELLOW=$(tput setab 3) | |
BOLD_RED=($BOLD$RED) | |
# Formatting | |
DIV="$BLACK---------------------------------------------------------------------$NOCOLOR" | |
TICK="$NOCOLOR[$GREEN+$NOCOLOR] " | |
TICK_MOVE="$NOCOLOR[$GREEN~>$NOCOLOR]" | |
TICK_BACKUP="$NOCOLOR[$GREEN<~$NOCOLOR] " | |
TICK_INPUT="$NOCOLOR[$YELLOW!$NOCOLOR] " | |
TICK_ERROR="$NOCOLOR[$RED!$NOCOLOR] " | |
TICK_INFO="$NOCOLOR[$YELLOW-$NOCOLOR] " | |
# Highlight | |
CRITICAL=($BG_YELLOW$BOLD_RED) | |
# Usage | |
echo $TICK$RED"This is RED" | |
echo $TICK$GREEN"This is GREEN" | |
echo $TICK$YELLOW"This is YELLOW" | |
echo $TICK$BLUE"This is BLUE" | |
echo $TICK$PURPLE"This is PURPLE" | |
echo $TICK$CYAN"This is CYAN" | |
echo $TICK$WHITE"This is WHITE" | |
echo $TICK$BLACK"This is BLACK" | |
echo $TICK$BG_YELLOW"This is BG_YELLOW"$NOCOLOR # Note you must unset this | |
echo $TICK$BOLD_RED"This is BOLD_RED" | |
echo $DIV | |
echo $TICK_INFO"This is TICK_INFO" | |
echo $TICK_ERROR"This is TICK_ERROR" | |
echo $TICK_MOVE"This is TICK_MOVE" | |
echo $TICK_BACKUP"This is TICK_BACKUP" |
Author
grahamhelton
commented
Mar 17, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment