Skip to content

Instantly share code, notes, and snippets.

@Marneus68
Created March 8, 2019 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marneus68/86ee4499926df02818bde552822973b6 to your computer and use it in GitHub Desktop.
Save Marneus68/86ee4499926df02818bde552822973b6 to your computer and use it in GitHub Desktop.
if test -t 1; then
ncolors=$(tput colors)
if test -n "$ncolors" && test $ncolors -ge 8; then
black=$(eval tput setaf 0);
red=$(eval tput setaf 1);
green=$(eval tput setaf 2);
yellow=$(eval tput setaf 3);
blue=$(eval tput setaf 4);
magenta=$(eval tput setaf 5);
cyan=$(eval tput setaf 6);
white=$(eval tput setaf 7);
reset=$(eval tput sgr0);
fi
else
black="";
red="";
green="";
yellow="";
blue="";
magenta="";
cyan="";
white="";
reset="";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment