forked from karpathy/ulogme
-
Notifications
You must be signed in to change notification settings - Fork 14
/
color.sh
86 lines (85 loc) · 3.32 KB
/
color.sh
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh
## About:
# This script define many useful colors code as Bash variables
# Use this script with other GNU Bash scripts, simply by importing him with
# $ . ~/.color.sh # if it is stored in your $HOME as .color.sh
# $ . color.sh # if it is stored in the current directory as color.sh (default)
#
## Web
# Both are on https://bitbucket.org/lbesson/bin/
# - https://bitbucket.org/lbesson/bin/src/master/.color.sh (to enable them)
# - https://bitbucket.org/lbesson/bin/src/master/.nocolor.sh (to disable them)
#
## How to use it after?
# For example, echo -e "${red}This part is red. ${blue}That's blue :) ${black}And black.${reset}${white}"
# will print: This part is red. That's blue :) And black. <-- with colors!
#
#
## Copyrigths:
# (c) 2013-15, Lilian Besson
#
## From ANSIColors.py module, auto generated with -g option. (*i.e.* the command './ANSIColors.py --generate')
# About the convention for the names of the colors :
# * for the eight colors black, red, green, yellow, blue, magenta, cyan, white:
# - the name in minuscule is for color **with bold** (example 'yellow'),
# - the name starting with 'B' is for color **without bold** (example 'Byellow'),
# - the name starting with a capital letter is for the backgroung color (example 'Yellow').
# * for the special effects (blink, italic, bold, underline, negative), **not always supported** :
# - the name in minuscule is for **activate** the effect,
# - the name starting in capital letter is for **desactivate** the effect.
# * for the other special effects (nocolors, default, Default, clear, el), the effect is **immediate** (and seems to be well supported).
#
#
## List of colors
# Text colors
export black="\033[01;30m"
export red="\033[01;31m"
export green="\033[01;32m"
export yellow="\033[01;33m"
export blue="\033[01;34m"
export magenta="\033[01;35m"
export cyan="\033[01;36m"
export white="\033[01;37m"
# Without bold colors
export Bblack="\033[02;30m"
export Bred="\033[02;31m"
export Bgreen="\033[02;32m"
export Byellow="\033[02;33m"
export Bblue="\033[02;34m"
export Bmagenta="\033[02;35m"
export Bcyan="\033[02;36m"
export Bwhite="\033[02;37m"
export Black="\033[40m"
# Background colors
export Red="\033[41m"
export Green="\033[42m"
export Yellow="\033[43m"
export Blue="\033[44m"
export Magenta="\033[45m"
export Cyan="\033[46m"
export White="\033[47m"
# Special effects
export Blink="\033[06m" # Start blinking
export blink="\033[05m" # Stop blinking
export nocolors="\033[0m"
export default="\033[39m"
export Default="\033[49m"
export italic="\033[3m" # Start italic
export Italic="\033[23m" # Stop italic
export b="\033[1m" # Start bold
export B="\033[2m" # Stop bold
export u="\033[4m" # Start underline
export U="\033[24m" # Stop underline
export neg="\033[7m" # Start negative
export Neg="\033[27m" # Stop negative
export clear="\033[2J" # Clear screen
export el="\r\033[K" # Erase line
export reset="\033[0;39;49m" # Reset ?
export bell="" # Alarm ?
export title="\033]0;" # Change title
export warning="\033[01;31m\033[4m/!\\033[24m\033[39m" # /!\ with colors
export question="\033[01;33m\033[4m/?\\033[24m\033[39m" # /?\ with colors
export ERROR="\033[0;39;49m\033[01;31mERROR\033[39m" # ERROR with colors
export WARNING="\033[0;39;49m\033[01;33mWARNING\033[39m" # WARNING with colors
export INFO="\033[0;39;49m\033[01;34mINFO\033[39m" # INFO with colors
#DONE