utilizing dircolors database as a proxy for color support
From:
Mike Frysinger
Subject:
utilizing dircolors database as a proxy for color support
Date:
Tue, 2 Feb 2016 17:22:34 -0500
we've long used the dircolors database as a proxy to see whether the
active terminal supports color. basically something like:
eval "$(dircolors -b)"
if [[ -n ${LS_COLORS} ]] ; then
# env supports colors
fi
but having to go through the eval & LS_COLORS testing is kind of annoying.
how do people feel about extending the interface so that we can merely test
the database ? something like:
dircolors --check-term[=TERM] [FILE]
then we can do:
if dircolors --check-term ; then
# env supports colors
fi
-mike