Browse code

only show colors on darwin and linux

Nat! authored on 04/01/2016 00:34:19
Showing 2 changed files
... ...
@@ -3,18 +3,25 @@
3 3
 # (c) 2015, coded by Nat!, Mulle KybernetiK
4 4
 #
5 5
 
6
-# Escape sequence and resets
7
-C_RESET="\033[0m"
6
+if [ "${MULLE_BOOTSTRAP_NO_COLOR}" != "YES" ]
7
+then
8
+   case `uname` in
9
+      Darwin|Linux)
10
+         # Escape sequence and resets
11
+         C_RESET="\033[0m"
8 12
 
9
-# Foreground colours
10
-C_BLACK="\033[0;30m"   C_RED="\033[0;31m"    C_GREEN="\033[0;32m"
11
-C_YELLOW="\033[0;33m"  C_BLUE="\033[0;34m"   C_MAGENTA="\033[0;35m"
12
-C_CYAN="\033[0;36m"    C_WHITE="\033[0;37m"  C_BR_BLACK="\033[0;90m"
13
+         # Foreground colours
14
+         C_BLACK="\033[0;30m"   C_RED="\033[0;31m"    C_GREEN="\033[0;32m"
15
+         C_YELLOW="\033[0;33m"  C_BLUE="\033[0;34m"   C_MAGENTA="\033[0;35m"
16
+         C_CYAN="\033[0;36m"    C_WHITE="\033[0;37m"  C_BR_BLACK="\033[0;90m"
13 17
 
14
-#
15
-# restore colors if stuff gets wonky
16
-#
17
-trap 'printf "${C_RESET}"' TERM EXIT
18
+         #
19
+         # restore colors if stuff gets wonky
20
+         #
21
+         trap 'printf "${C_RESET}"' TERM EXIT
22
+         ;;
23
+   esac
24
+fi
18 25
 
19 26
 #
20 27
 # https://github.com/hoelzro/useful-scripts/blob/master/decolorize.pl
... ...
@@ -29,19 +29,24 @@
29 29
 #   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 30
 #   POSSIBILITY OF SUCH DAMAGE.
31 31
 
32
-# Escape sequence and resets
32
+# Escape sequence and resets, should use tput here instead of ANSI
33
+
33 34
 if [ "${MULLE_BOOTSTRAP_NO_COLOR}" != "YES" ]
34 35
 then
35
-   C_RESET="\033[0m"
36
+   case `uname` in
37
+      Darwin|Linux)
38
+         C_RESET="\033[0m"
36 39
 
37
-   # Foreground colours
38
-   C_BLACK="\033[0;30m"   C_RED="\033[0;31m"    C_GREEN="\033[0;32m"
39
-   C_YELLOW="\033[0;33m"  C_BLUE="\033[0;34m"   C_MAGENTA="\033[0;35m"
40
-   C_CYAN="\033[0;36m"    C_WHITE="\033[0;37m"  C_BR_BLACK="\033[0;90m"
40
+         # Foreground colours
41
+         C_BLACK="\033[0;30m"   C_RED="\033[0;31m"    C_GREEN="\033[0;32m"
42
+         C_YELLOW="\033[0;33m"  C_BLUE="\033[0;34m"   C_MAGENTA="\033[0;35m"
43
+         C_CYAN="\033[0;36m"    C_WHITE="\033[0;37m"  C_BR_BLACK="\033[0;90m"
41 44
 
42
-   C_BR_RED="\033[0;91m" C_BR_YELLOW="\033[0;93m"
45
+         C_BR_RED="\033[0;91m" C_BR_YELLOW="\033[0;93m"
43 46
 
44
-   trap 'printf "${C_RESET}"' TERM EXIT
47
+         trap 'printf "${C_RESET}"' TERM EXIT
48
+         ;;
49
+   esac
45 50
 fi
46 51
 
47 52