Created
November 7, 2021 21:52
-
-
Save threeiem/d3c8f73719c4204c4ba46b9c4b5dc317 to your computer and use it in GitHub Desktop.
Colors are life...
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
#!/usr/bin/env bash | |
################################################################################ | |
# Colors | |
# | |
# File that contains all the local colors in semi easy to use strings. Thse can | |
# be mixed together to get the desired color intensity and background. | |
# | |
################################################################################ | |
[[ -t 2 && $TERM != dumb ]] && { | |
# Dimensions | |
#------------------------------------------------------------------------------- | |
# Columns in a line | |
export COLS=$({ tput cols || tput co;} 2> /dev/null) | |
# Lines in the screen | |
export ROWS=$({ tput lines || tput li;} 2> /dev/null) | |
# Controls | |
#------------------------------------------------------------------------------- | |
# Reset | |
export Reset=$({ tput sgr0 || tput me;} 2> /dev/null) | |
# Bold | |
export Bold=$({ tput bold || tput md;} 2> /dev/null) | |
# Blink | |
export Blink=$({ tput blink || tput mb;} 2> /dev/null) | |
# Intense | |
export Intense=$({ tput smso || tput so;} 2> /dev/null) | |
# Intense Stop | |
export Intense_Stop=$({ tput rmso || tput se;} 2> /dev/null) | |
# Basic Colors | |
#------------------------------------------------------------------------------- | |
# Black | |
export Black=$({ tput setaf 0 || tput AF 0;} 2> /dev/null) | |
# White | |
export White=$({ tput setaf 7 || tput AF 7;} 2> /dev/null) | |
# Fancy Colors | |
#------------------------------------------------------------------------------- | |
[[ $TERM != *-m ]] && { | |
# Red | |
export Red=$({ tput setaf 1 || tput AF 1;} 2> /dev/null) | |
# Green | |
export Green=$({ tput setaf 2 || tput AF 2;} 2> /dev/null) | |
# Yellow | |
export Yellow=$({ tput setaf 3 || tput AF 3;} 2> /dev/null) | |
# Blue | |
export Blue=$({ tput setaf 4 || tput AF 4;} 2> /dev/null) | |
# Purple | |
export Purple=$({ tput setaf 5 || tput AF 5;} 2> /dev/null) | |
# Cyan | |
export Cyan=$({ tput setaf 6 || tput AF 6;} 2> /dev/null) | |
} | |
} | |
if [ "${TERM_PROGRAM}" == "Apple_Terminal" ]; then | |
export CLICOLOR=1 | |
export LSCOLORS=ExFxBxDxCxegedabagacad | |
else | |
eval "export $(dircolors --bourne-shell)" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment