Make the colorized build output readable on a light background

This fixes the readability of colorized output of compile.sh when
running on a terminal with a light background.  It uses the COLORFGBG
environment variable similarly to how the ip(8) command does.

Signed-off-by: Darsey Litzenberger <dlitz@dlitz.net>
This commit is contained in:
Darsey Litzenberger
2024-02-08 21:33:19 -07:00
committed by Igor
parent 110798c904
commit ce33bddb58
11 changed files with 118 additions and 19 deletions

View File

@@ -30,7 +30,10 @@ function display_alert() {
skip_screen=1
fi
level_indicator="🐛"
inline_logs_color="\e[1;33m"
case "${background_dark_or_light}" in
light) inline_logs_color="\e[1;2;33m" ;;
*) inline_logs_color="\e[1;33m" ;;
esac
skip_logfile=1
;;
@@ -44,7 +47,10 @@ function display_alert() {
info)
level_indicator="🌱"
inline_logs_color="\e[0;32m"
case "${background_dark_or_light}" in
light) inline_logs_color="\e[1;2;32m" ;;
*) inline_logs_color="\e[1;32m" ;;
esac
;;
cleanup | trap)
@@ -52,7 +58,10 @@ function display_alert() {
skip_screen=1
fi
level_indicator="🧽"
inline_logs_color="\e[1;33m"
case "${background_dark_or_light}" in
light) inline_logs_color="\e[1;2;33m" ;;
*) inline_logs_color="\e[1;33m" ;;
esac
skip_logfile=1
;;
@@ -141,7 +150,10 @@ function display_alert() {
ext)
level_indicator="✨"
inline_logs_color="\e[1;32m"
case "${background_dark_or_light}" in
light) inline_logs_color="\e[1;2;32m" ;;
*) inline_logs_color="\e[1;32m" ;;
esac
;;
change-tracking)
@@ -152,7 +164,10 @@ function display_alert() {
*)
level="${level:-info}" # for file logging.
level_indicator="🌿"
inline_logs_color="\e[1;37m"
case "${background_dark_or_light}" in
dark) inline_logs_color="\e[1;37m" ;;
*) inline_logs_color="\e[1;39m" ;;
esac
;;
esac