Implement terminal color detection

Add terminal color support based on output type
This commit is contained in:
andremarzano
2025-11-21 16:14:10 -03:00
committed by GitHub
parent d2711cf469
commit e73f7312af

12
maza
View File

@@ -11,9 +11,15 @@ THIS_OS=$(uname -mrs)
PROGNAME=$(basename "$0") PROGNAME=$(basename "$0")
[[ -z "${XDG_CONFIG_HOME}" ]] && CONFIG=$HOME/.config/maza/ || CONFIG=$XDG_CONFIG_HOME/maza/ [[ -z "${XDG_CONFIG_HOME}" ]] && CONFIG=$HOME/.config/maza/ || CONFIG=$XDG_CONFIG_HOME/maza/
HOST_FILE=/etc/hosts HOST_FILE=/etc/hosts
COLOR_RED=$(tput setaf 1) if [ -t 1 ]; then
COLOR_GREEN=$(tput setaf 2) COLOR_RED=$(tput setaf 1 2>/dev/null || true)
COLOR_RESET=$(tput sgr0) COLOR_GREEN=$(tput setaf 2 2>/dev/null || true)
COLOR_RESET=$(tput sgr0 2>/dev/null || true)
else
COLOR_RED=""
COLOR_GREEN=""
COLOR_RESET=""
fi
LIST="list" LIST="list"
LIST_DNSMASQ="dnsmasq.conf" LIST_DNSMASQ="dnsmasq.conf"
CUSTOM_DOMAINS="custom-domains" CUSTOM_DOMAINS="custom-domains"