Alexpux / MSYS2-pacman

MSYS2 port of Arch Linux packman package manager.
GNU General Public License v2.0
164 stars 34 forks source link

update-core's msg()/warning()/error() print color messages that could be hard to read on light-bg terminal #27

Open ElTopo opened 8 years ago

ElTopo commented 8 years ago

I am using a light background terminal, when running update-core some color messages are very hard to read.

msg()/warning()/error() print out color messages like this on my terminal: https://www.flickr.com/gp/lxl221/d9W0cJ

I know I can use $nocolor environment variable to force the script to print colorless messages, but it would be nice to see colors.

The fix is simple, just set the color message's background to black (since the code was written for dark background terminals):

# colors
if [[ -t 1 && -z "${nocolor}" ]]; then
  color_red='\e[40;1;31m'
  color_yellow='\e[40;1;33m'
  color_blue='\e[40;1;34m'
  color_white='\e[40;1;37m'
  color_normal='\e[0m'
fi

The same messages with the fix: https://www.flickr.com/gp/lxl221/a405GG