Skip to content

Commit

Permalink
Fix to add support for bright colors ; add BLACK color
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Dec 8, 2022
1 parent fd83140 commit c0fed1f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions slib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ if command -pv 'tput' > /dev/null; then
# does the terminal have colors?
ncolors=$(tput colors)
if [ "$ncolors" -ge 8 ]; then
BLACK="$(tput setaf 0)"
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
Expand All @@ -50,13 +51,22 @@ if command -pv 'tput' > /dev/null; then
CYANBG=$(tput setab 6)
WHITEBG=$(tput setab 7)

# Do wee have support
# for bright colors?
if [ "$ncolors" -ge 16 ]; then
BLACK="$(tput setaf 16)"
WHITE=$(tput setaf 15)
WHITEBG=$(tput setab 15)
fi

BOLD=$(tput bold)
UNDERLINE=$(tput smul) # Many terminals don't support this
NORMAL=$(tput sgr0)
fi
fi
else
echo "tput not found, colorized output disabled."
BLACK=''
RED=''
GREEN=''
YELLOW=''
Expand Down

0 comments on commit c0fed1f

Please sign in to comment.