94 lines
1.8 KiB
Ruby
Executable File
94 lines
1.8 KiB
Ruby
Executable File
#!/usr/bin/env ruby
|
|
|
|
def print_flag palette, num, colors
|
|
for fg in colors
|
|
printf "\e[48;2;%sm%s", palette[fg], ?\s * num
|
|
end
|
|
printf "\e[m\n"
|
|
end
|
|
|
|
names = {
|
|
0 => "regular",
|
|
1 => "bold",
|
|
2 => "faint",
|
|
3 => "italic",
|
|
4 => "underline",
|
|
5 => "blink",
|
|
6 => "blink2",
|
|
7 => "reverse",
|
|
8 => "conceal",
|
|
9 => "strike",
|
|
11 => "font1",
|
|
12 => "font2",
|
|
13 => "font3",
|
|
14 => "font4",
|
|
15 => "font5",
|
|
16 => "font6",
|
|
17 => "font7",
|
|
18 => "font8",
|
|
19 => "font9",
|
|
20 => "fraktur",
|
|
21 => "doubleline",
|
|
51 => "framed",
|
|
52 => "encircled",
|
|
53 => "overlined",
|
|
60 => "irsline",
|
|
61 => "idoubleline",
|
|
62 => "ilsline",
|
|
63 => "ioverline2",
|
|
64 => "istress",
|
|
}
|
|
|
|
puts "Terminal modes"
|
|
for mode in Enumerator::Chain.new(0..9, 11..21, 51..53, 60..64)
|
|
name = names[mode]
|
|
printf "Mode %2d: ", mode
|
|
for bg in Enumerator::Chain.new([49], 40..47)
|
|
printf "\e[%d;%dmlorem", mode, bg
|
|
end
|
|
printf "\e[m (%s)\n", name
|
|
end
|
|
puts
|
|
|
|
puts "4 bit color"
|
|
for bg in Enumerator::Chain.new([49], 40..47)
|
|
for fg in Enumerator::Chain.new([39], 30..37)
|
|
printf "\e[%d;%dm%d %d", bg, fg, bg, fg
|
|
end
|
|
printf "\e[m\n"
|
|
end
|
|
puts
|
|
|
|
puts "8 bit color"
|
|
for fg in 0..15
|
|
printf "\e[48;5;%dm%3d", fg, fg
|
|
printf "\e[m\n" if fg % 8 == 7
|
|
end
|
|
printf "\e[m\n"
|
|
|
|
for fg in 16..255
|
|
printf "\e[48;5;%dm%4d", fg, fg
|
|
printf "\e[m\n" if (fg - 15) % 6 == 0
|
|
end
|
|
printf "\e[m\n"
|
|
puts
|
|
|
|
roygcbvp = %w(242;119;119 242;160;119 242;217;119 137;242;119
|
|
119;234;242 119;123;242 180;119;242 242;119;236)
|
|
flag1 = %w(91;207;250 245;171;185 255;255;255)
|
|
flag2 = %w(255;244;44 255;255;255 157;89;210 0;0;0)
|
|
|
|
puts "24 bit color"
|
|
print_flag roygcbvp, 10, 0..7
|
|
print_flag flag1, 16, [0, 1, 2, 1, 0]
|
|
print_flag flag2, 20, 0..3
|
|
puts
|
|
|
|
puts "These colors must not be the same."
|
|
puts "If they are, your terminal is not using truecolor."
|
|
puts
|
|
puts "\e[48;5;134m 8bit\e[m"
|
|
puts "\e[48;2;157;89;210m 24bit"
|
|
|
|
## EOF
|