-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathansi-color-test.sh
More file actions
executable file
·88 lines (76 loc) · 2.26 KB
/
ansi-color-test.sh
File metadata and controls
executable file
·88 lines (76 loc) · 2.26 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
80
81
82
83
84
85
86
87
88
#!/bin/bash
# https://github.com/nesterenkovy/ANSI-Color-Test/blob/main/bash/ansi-color-test.sh
# Function for outputting color table
output_color() {
local color="$1"
# Table fields separator
text="myTest"
# Move to new line
echo ""
# Display an empty field in the background color names line
echo -n " "
# Display color names with the same width
for color in "${colors[@]}"; do
echo -n "${color%%:*} "
done
echo ""
# Cycle to display a table of text and background combinations
for fg_color in "${colors[@]}"; do
IFS=":" read -r name fg bgt <<< "$fg_color"
echo -en "$name"
for bg_color in "${colors[@]}"; do
IFS=":" read -r nt fgt bg <<< "$bg_color"
echo -en " $fg$bg $text \033[0m"
done
echo ""
done
echo ""
}
# Screen cleaning
clear
# Array of ANSI colors for text and background
colors=(
"Default :\033[m:"
"Black :\033[30m:\033[40m"
"Red :\033[31m:\033[41m"
"Green :\033[32m:\033[42m"
"Yellow :\033[33m:\033[43m"
"Blue :\033[34m:\033[44m"
"Purple :\033[35m:\033[45m"
"Cyan :\033[36m:\033[46m"
"White :\033[37m:\033[47m"
"L_Black :\033[90m:\033[100m"
"L_Red :\033[91m:\033[101m"
"L_Green :\033[92m:\033[102m"
"L_Yellow:\033[93m:\033[103m"
"L_Blue :\033[94m:\033[104m"
"L_Purple:\033[95m:\033[105m"
"L_Cyan :\033[96m:\033[106m"
"L_White :\033[97m:\033[107m"
"Default :\033[m:"
)
# Call the function for outputting the table of colors
output_color $color
# Array of ANSI colors for text and background
colors=(
"Default :\033[m:"
"Black :\033[30m:\033[40m"
"L_Black :\033[90m:\033[100m"
"Red :\033[31m:\033[41m"
"L_Red :\033[91m:\033[101m"
"Green :\033[32m:\033[42m"
"L_Green :\033[92m:\033[102m"
"Yellow :\033[33m:\033[43m"
"L_Yellow:\033[93m:\033[103m"
"Blue :\033[34m:\033[44m"
"L_Blue :\033[94m:\033[104m"
"Purple :\033[35m:\033[45m"
"L_Purple:\033[95m:\033[105m"
"Cyan :\033[36m:\033[46m"
"L_Cyan :\033[96m:\033[106m"
"White :\033[37m:\033[47m"
"L_White :\033[97m:\033[107m"
"Default :\033[m:"
)
# Call the function for outputting the table of colors
output_color $color