-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathansi
More file actions
executable file
·79 lines (73 loc) · 2.35 KB
/
ansi
File metadata and controls
executable file
·79 lines (73 loc) · 2.35 KB
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
#!/bin/bash
# Function to get ANSI escape code for text style by name
code=""
case "$1" in
reset) code="\033[0m" ;;
blinkoff) code="\033[25m" ;;
blink) code="\033[5m" ;;
boldoff) code="\033[22m" ;;
bold) code="\033[1m" ;;
dimoff) code="\033[22m" ;;
dim) code="\033[2m" ;;
hidden) code="\033[8m" ;;
hiddenoff) code="\033[28m" ;;
reverse) code="\033[7m" ;;
reverseoff) code="\033[27m" ;;
italicoff) code="\033[23m" ;;
italic) code="\033[3m" ;;
underlineoff) code="\033[24m" ;;
underline) code="\033[4m" ;;
strikeoff) code="\033[29m" ;;
strike) code="\033[9m" ;;
formataccent) code="\033[32;1m" ;;
erroraccent) code="\033[36;1m" ;;
error) code="\033[31;1m" ;;
warning) code="\033[33;1m" ;;
verbose) code="\033[33;1m" ;;
debug) code="\033[33;1m" ;;
tableheader) code="\033[32;1m" ;;
customtableheaderlabel) code="\033[32;1;3m" ;;
feedbackname) code="\033[33m" ;;
feedbacktext) code="\033[96m" ;;
feedbackaction) code="\033[97m" ;;
directory) code="\033[44;1m" ;;
symboliclink) code="\033[36;1m" ;;
executable) code="\033[32;1m" ;;
black) code="\033[30m" ;;
brightblack) code="\033[90m" ;;
white) code="\033[37m" ;;
brightwhite) code="\033[97m" ;;
red) code="\033[31m" ;;
brightred) code="\033[91m" ;;
magenta) code="\033[35m" ;;
brightmagenta) code="\033[95m" ;;
blue) code="\033[34m" ;;
brightblue) code="\033[94m" ;;
cyan) code="\033[36m" ;;
brightcyan) code="\033[96m" ;;
green) code="\033[32m" ;;
brightgreen) code="\033[92m" ;;
yellow) code="\033[33m" ;;
brightyellow) code="\033[93m" ;;
Black) code="\033[40m" ;;
Brightblack) code="\033[100m" ;;
White) code="\033[47m" ;;
Brightwhite) code="\033[107m" ;;
Red) code="\033[41m" ;;
Brightred) code="\033[101m" ;;
Magenta) code="\033[45m" ;;
Brightmagenta) code="\033[105m" ;;
Blue) code="\033[44m" ;;
Brightblue) code="\033[104m" ;;
Cyan) code="\033[46m" ;;
Brightcyan) code="\033[106m" ;;
Green) code="\033[42m" ;;
Brightgreen) code="\033[102m" ;;
Yellow) code="\033[43m" ;;
Brightyellow) code="\033[103m" ;;
*) code="" ;; # Unknown style, return empty string
esac
echo -e "${code}"
# Example usage:
# style="bold"
# echo "$(get_ansi_code "$style")This is bold text$(get_ansi_code "reset")"