File: colors.sh

package info (click to toggle)
cadical 2.1.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,224 kB
  • sloc: cpp: 36,901; ansic: 4,521; sh: 1,770; makefile: 91
file content (29 lines) | stat: -rw-r--r-- 487 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Use colors if '<stdin>' is connected to a terminal.

color_echo_options=""

if [ -t 1 ]
then
  BAD="\033[1;31m"  # bright red
  HILITE="\033[32m" # normal green
  GOOD="\033[1;32m" # bright green
  HIDE="\033[34m"   # cyan
  BOLD="\033[1m"    # bold color
  NORMAL="\033[0m"  # normal color

  if [ x"`echo -e 2>/dev/null`" = x ]
  then
    color_echo_options=" -e"
  fi
else
  BAD=""
  HILITE=""
  GOOD=""
  HIDE=""
  BOLD=""
  NORMAL=""
fi

cecho () {
  echo$color_echo_options $*
}