-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolors
65 lines (53 loc) · 1.67 KB
/
colors
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
#!/bin/bash
# Function to print color blocks
print_color_blocks() {
local start=$1
local end=$2
local prefix=$3
for i in $(seq "$start" "$end"); do
printf "\e[${prefix}${i}m %3d \e[0m" "$i"
done
echo
}
# Print header
echo -e "\nStandard colors:"
echo "Foreground: 30-37 | Background: 40-47"
echo "Bright Foreground: 90-97 | Bright Background: 100-107"
# Print foreground colors
echo -e "\nForeground colors:"
print_color_blocks 30 37 ""
print_color_blocks 90 97 ""
# Print background colors
echo -e "\nBackground colors:"
print_color_blocks 40 47 ""
print_color_blocks 100 107 ""
# Function to print color combinations
print_color_combinations() {
local fg_start=$1
local fg_end=$2
local bg_start=$3
local bg_end=$4
for fg in $(seq "$fg_start" "$fg_end"); do
for bg in $(seq "$bg_start" "$bg_end"); do
printf "\e[${fg}m\e[${bg}m %3d;%3d \e[0m" "$fg" "$bg"
done
echo
done
}
# Print all combinations
echo -e "\nAll color combinations:"
echo "Standard foreground (30-37) with standard background (40-47):"
print_color_combinations 30 37 40 47
echo -e "\nBright foreground (90-97) with standard background (40-47):"
print_color_combinations 90 97 40 47
echo -e "\nStandard foreground (30-37) with bright background (100-107):"
print_color_combinations 30 37 100 107
echo -e "\nBright foreground (90-97) with bright background (100-107):"
print_color_combinations 90 97 100 107
# Print text attributes
echo -e "\nText attributes:"
attributes=("Normal" "Bold" "Dim" "Italic" "Underline" "Blink" "Reverse" "Hidden")
for i in {0..7}; do
printf "\e[${i}m%s\e[0m " "${attributes[$i]}"
done
echo -e "\n"