mavtables  0.2.1
MAVLink router and firewall.
ansi_codes.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 # Copyright 2017 Michael R. Shannon <mrshannon.aerospace@gmail.com>
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 
17 
18 # BASH library that provides variables for the ANSI escape codes.
19 #
20 # To use this library simply source the file:
21 #
22 # $ source ansi_codes
23 #
24 # Codes to turn on a feature begin with and underscore while those to disable
25 # the feature end in an underscore.
26 #
27 # Example:
28 #
29 # $ echo "This is ${_BOLD}bold${BOLD_}."
30 # $ echo "This is ${_RED}red${RED_}."
31 # $ echo "This is ${_BOLD}${_RED}bold and red${RED_}${BOLD_}."
32 
33 
34 # Reset all ANSI codes.
35 ANSI_RESET="\e[0m"
36 
37 # Font properties.
38 _BOLD="\e[1m"
39 BOLD_="\e[21m"
40 _ITALICS="\e[3m"
41 ITALICS_="\e[23m"
42 _UNDERLINE_="\e[4m"
43 UNDERLINE_="\e[24m"
44 _INVERSE="\e[7m"
45 INVERSE_="\e[27m"
46 _STRIKE="\e[9m"
47 STRIKE_="\e[29m"
48 
49 # Forground colors.
50 _BLACK="\e[30m"
51 BLACK_="\e[39m"
52 _RED="\e[31m"
53 RED_="\e[39m"
54 _GREEN="\e[32m"
55 GREEN_="\e[39m"
56 _YELLOW="\e[33m"
57 YELLOW_="\e[39m"
58 _BLUE="\e[34m"
59 BLUE_="\e[39m"
60 _MAGENTA="\e[35m"
61 MAGENTA_="\e[39m"
62 _CYAN="\e[36m"
63 CYAN_="\e[39m"
64 _WHITE="\e[37m"
65 WHITE_="\e[39m"
66 FG_RESET="\e[39m"
67 
68 # Background colors.
69 _BG_BLACK="\e[40m"
70 BG_BLACK_="\e[49m"
71 _BG_RED="\e[41m"
72 BG_RED_="\e[49m"
73 _BG_GREEN="\e[42m"
74 BG_GREEN_="\e[49m"
75 _BG_YELLOW="\e[43m"
76 BG_YELLOW_="\e[49m"
77 _BG_BLUE="\e[44m"
78 BG_BLUE_="\e[49m"
79 _BG_MAGENTA="\e[45m"
80 BG_MAGENTA_="\e[49m"
81 _BG_CYAN="\e[46m"
82 BG_CYAN_="\e[49m"
83 _BG_WHITE="\e[47m"
84 BG_WHITE_="\e[49m"
85 BG_RESET="\e[49m"