Support systemd-style output via lsb-functions
[grml-etc-core.git] / etc / grml_colors
index 77cb8ba..a78a9ab 100644 (file)
@@ -5,22 +5,32 @@
 # License:       This file is licensed under the GPL v2.
 ################################################################################
 
+# don't use highlighed colors under systemd to match its style
+if [ "$(cat /proc/1/comm 2>/dev/null)" = "systemd" ] ; then
+  HIGHLIGHT=0
+else
+  HIGHLIGHT=1
+fi
+
 # ANSI COLORS
 CRE="\r\e[K"
 NORMAL="\e[0;39m"
 # RED: Failure or error message
-RED="\e[1;31m"
+RED="\e[${HIGHLIGHT};31m"
 # GREEN: Success message
-GREEN="\e[1;32m"
+GREEN="\e[${HIGHLIGHT};32m"
 # YELLOW: Descriptions
-YELLOW="\e[1;33m"
+YELLOW="\e[${HIGHLIGHT};33m"
 # BLUE: System messages
-BLUE="\e[1;34m"
+BLUE="\e[${HIGHLIGHT};34m"
 # MAGENTA: Found devices or drivers
-MAGENTA="\e[1;35m"
+MAGENTA="\e[${HIGHLIGHT};35m"
 # CYAN: Questions
-CYAN="\e[1;36m"
+CYAN="\e[${HIGHLIGHT};36m"
 # BOLD WHITE: Hint
-WHITE="\e[1;37m"
+WHITE="\e[${HIGHLIGHT};37m"
+
+# don't expose unneeded local variables
+unset HIGHLIGHT
 
 ## END OF FILE #################################################################