libmsgmng.lib: allow users to modify ESC, CRIT, NOTE, WARN, EXIT, and NORM color codes
Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
parent
8b6e2b2c50
commit
924f2b2cab
@ -30,6 +30,13 @@ Fri Nov 09 2012 Davide Madrisan <davide.madrisan(a)gmail.com>
|
||||
Postpone the load of libcfg.lib to allow users to set a different
|
||||
configuration file (will be done in a following patch).
|
||||
|
||||
+ improvement
|
||||
* lib/libmsgmng.lib - Davide Madrisan:
|
||||
Do not set ESC, CRIT, NOTE, WARN, EXIT, and NORM when already defined by
|
||||
the user. This will permit users to redefine the terminal colors or even
|
||||
define very different color sequences, like the colors used in web pages.
|
||||
(A feature asked by Silvan for openmamba webbuild).
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Changes in version 1.14.0
|
||||
|
@ -17,12 +17,12 @@ TEXTDOMAIN="libmsgmng"; export TEXTDOMAIN
|
||||
# none
|
||||
function notify.enable_colors() {
|
||||
if [[ -t 1 && "$TERM" != raw && "$TERM" != dumb ]]; then
|
||||
ESC=$(echo -en "\033") # ascii ESCape
|
||||
CRIT="${ESC}[1;31m" # switch on red
|
||||
NOTE="${ESC}[1;33m" # switch on yellow
|
||||
WARN="${ESC}[1;31m"
|
||||
EXIT="${ESC}[1;31m"
|
||||
NORM=$(echo -en "${ESC}[m\017")
|
||||
ESC=$(echo -en "\033") # ascii ESCape
|
||||
[ "$CRIT" ] || CRIT="${ESC}[1;31m" # switch on red
|
||||
[ "$NOTE" ] || NOTE="${ESC}[1;33m" # switch on yellow
|
||||
[ "$WARN" ] || WARN="${ESC}[1;31m"
|
||||
[ "$EXIT" ] || EXIT="${ESC}[1;31m"
|
||||
[ "$NORM" ] || NORM=$(echo -en "${ESC}[m\017")
|
||||
else
|
||||
ESC= CRIT= NOTE= WARN= EXIT= NORM=
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user