-
Notifications
You must be signed in to change notification settings - Fork 1
/
.nocolor.sh
executable file
·87 lines (87 loc) · 2.9 KB
/
.nocolor.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
86
87
#!/bin/sh
## About:
# This script remove all the colors defined in my .color.sh script.
# Use this script with other GNU Bash scripts, simply by importing him with
# $ . ~/.nocolor.sh
#
## Web
# Both are on https://bitbucket.org/lbesson/bin/
# - https://bitbucket.org/lbesson/bin/src/master/.nocolor.sh (to disable them)
# - https://bitbucket.org/lbesson/bin/src/master/.color.sh (to enable 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. <-- WITHOUT colors!
#
## Warning:
# Removing the color aliases is NOT recursive: if a script calls a script using ~/.color.sh (or any ANSI color codes), it will not work.
# You can pipe a colored command through ' | sed -r "s:\x1B\[[0-9;]*[mK]::g"' to remove all colors.
#
## Copyrigths:
# (c) 2013-17, 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=""
export red=""
export green=""
export yellow=""
export blue=""
export magenta=""
export cyan=""
export white=""
# Without bold colors
export Bblack=""
export Bred=""
export Bgreen=""
export Byellow=""
export Bblue=""
export Bmagenta=""
export Bcyan=""
export Bwhite=""
# Background colors
export Black=""
export Red=""
export Green=""
export Yellow=""
export Blue=""
export Magenta=""
export Cyan=""
export White=""
# Special effects
export blink="" # Start blinking
export Blink="" # Stop blinking
export nocolors=""
export default=""
export Default=""
export italic="" # Start italic
export Italic="" # Stop italic
export b="" # Start bold
export B="" # Stop bold
export u="" # Start underline
export U="" # Stop underline
export neg="" # Start negative
export Neg="" # Stop negative
export clear="" # Clear screen
export el="" # Erase line
export reset="" # Reset ?
export bell="" # Alarm ?
export title="" # Change title
export warning="" # /!\ with colors
export question="" # /?\ with colors
export ERROR="" # ERROR with colors
export WARNING="" # WARNING with colors
export INFO="" # INFO with colors
# DONE