Last active
August 25, 2019 11:39
-
-
Save jmatthewturner/2aeee120aa112fd51b000e13579c2654 to your computer and use it in GitHub Desktop.
Color Definitions for Bash Scripting
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 | |
# This is a script that defines a list of basic colors for use with | |
# text formatting in other scripts. It does not cover all possible colors, | |
# but it's a solid starting point. | |
# | |
# Usage: include this line at the top of any script that uses these colors: | |
# source [path to script]/colors.sh | |
# Then format like this: | |
# echo -e "This color is ${GREEN}green${RESET}." | |
# | |
# These colors are based on the information in this guide: | |
# https://misc.flogisoft.com/bash/tip_colors_and_formatting | |
# | |
# Written by jmatthewturner | |
# https://github.com/jmatthewturner | |
# https://www.youtube.com/jmatthewturner/ | |
# | |
# https://gist.github.com/jmatthewturner/2aeee120aa112fd51b000e13579c2654 | |
# | |
# ================================================================= | |
# Reset Attributes | |
# ================================================================= | |
RESET="\033[0m" # Reset All | |
RBOLD="\033[21m" # Reset Bold/Bright | |
RDIM="\033[22m" # Reset Dim | |
RUNDERLINE="\033[24m" # Reset Underline | |
RBLINK="\033[25m" # Reset Blink | |
RINVERT="\033[27m" # Reset Invert | |
RHIDE="\033[28m" # Reset Hide | |
# ================================================================= | |
# Text - Basic Rainbow Colors | |
# ================================================================= | |
DEFAULT="\033[39m" | |
BLACK="\033[30m" | |
WHITE="\033[97m" | |
RED="\033[31m" | |
GREEN="\033[32m" | |
YELLOW="\033[33m" | |
BLUE="\033[34m" | |
MAGENTA="\033[35m" | |
CYAN="\033[36m" | |
BOLDBLACK="\033[1;30m" | |
BOLDWHITE="\033[1;97m" | |
BOLDRED="\033[1;31m" | |
BOLDGREEN="\033[1;32m" | |
BOLDYELLOW="\033[1;33m" | |
BOLDBLUE="\033[1;34m" | |
BOLDMAGENTA="\033[1;35m" | |
BOLDCYAN="\033[1;36m" | |
# ================================================================= | |
# Text - Gradients | |
# ================================================================= | |
LIGHTGRAY="\033[37m" | |
DARKGRAY="\033[90m" | |
LIGHTRED="\033[91m" | |
LIGHTGREEN="\033[92m" | |
LIGHTYELLOW="\033[93m" | |
LIGHTBLUE="\033[94m" | |
LIGHTMAGENTA="\033[95m" | |
LIGHTCYAN="\033[96m" | |
# ================================================================= | |
# Background - Basic Rainbow Colors | |
# ================================================================= | |
BACKDEFAULT="\033[49m" | |
BACKBLACK="\033[40m" | |
BACKWHITE="\033[107m" | |
BACKRED="\033[41m" | |
BACKGREEN="\033[42m" | |
BACKYELLOW="\033[43m" | |
BACKBLUE="\033[44m" | |
BACKMAGENTA="\033[45m" | |
BACKCYAN="\033[46m" | |
# ================================================================= | |
# Background - Gradients | |
# ================================================================= | |
BACKLIGHTGRAY="\033[47m" | |
BACKDARKGRAY="\033[100m" | |
BACKLIGHTRED="\033[101m" | |
BACKLIGHTGREEN="\033[102m" | |
BACKLIGHTYELLOW="\033[103m" | |
BACKLIGHTBLUE="\033[104m" | |
BACKLIGHTMAGENTA="\033[105m" | |
BACKLIGHTCYAN="\033[106m" | |
# ================================================================= | |
# Other Formatting | |
# ================================================================= | |
BOLD="\033[1m" | |
DIM="\033[2m" | |
UNDERLINE="\033[4m" | |
BLINK="\033[5m" | |
INVERT="\033[7m" | |
HIDE="\033[8m" | |
# | |
# https://gist.github.com/jmatthewturner/2aeee120aa112fd51b000e13579c2654 | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment