mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[scripts/colortest] add another script which prints color codes
This commit is contained in:
parent
8891f63982
commit
630d6885a1
4 changed files with 20 additions and 8 deletions
|
@ -14,20 +14,24 @@ BEGIN {
|
||||||
print "";
|
print "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function print_color(color) {
|
function print_color(color, idx) {
|
||||||
printf "\033[48;5;%sm \033[0m", color
|
if (OPT_COLOR_CODES) {
|
||||||
|
printf "\033[1;30;48;5;%sm %02X \033[0m", color, idx;
|
||||||
|
} else {
|
||||||
|
printf "\033[48;5;%sm \033[0m", color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_standard_colors() {
|
function test_standard_colors() {
|
||||||
print "16 standard colors:";
|
print "16 standard colors:";
|
||||||
for (color = 0; color < 16; color += 1) print_color(color);
|
for (color = 0; color < 16; color += 1) print_color(color, color);
|
||||||
print "";
|
print "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_base16_colorscheme() {
|
function test_base16_colorscheme() {
|
||||||
print "base16 colorscheme:";
|
print "base16 colorscheme:";
|
||||||
split("0 18 19 8 20 7 21 15 1 16 3 2 6 4 5 17", colors, " ");
|
split("0 18 19 8 20 7 21 15 1 16 3 2 6 4 5 17", colors, " ");
|
||||||
for (i = 1; i <= length(colors); i++) print_color(colors[i]);
|
for (i = 1; i <= length(colors); i++) print_color(colors[i], i - 1);
|
||||||
print "";
|
print "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +43,8 @@ function test_6x6x6_cube() {
|
||||||
for (row = 0; row < 6; row++) {
|
for (row = 0; row < 6; row++) {
|
||||||
for (block_x = 0; block_x < block_grid_w; block_x++) {
|
for (block_x = 0; block_x < block_grid_w; block_x++) {
|
||||||
for (col = 0; col < 6; col++) {
|
for (col = 0; col < 6; col++) {
|
||||||
print_color(16 + col + 6*row + 6*6*block_x + block_grid_w*6*6*block_y);
|
color = col + 6*row + 6*6*block_x + block_grid_w*6*6*block_y
|
||||||
|
print_color(16 + color, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print "";
|
print "";
|
||||||
|
@ -50,7 +55,7 @@ function test_6x6x6_cube() {
|
||||||
function test_grayscale() {
|
function test_grayscale() {
|
||||||
print "grayscale from black to white in 24 steps:";
|
print "grayscale from black to white in 24 steps:";
|
||||||
for (color = 0; color < 24; color += 1) {
|
for (color = 0; color < 24; color += 1) {
|
||||||
print_color(16 + 6*6*6 + color)
|
print_color(16 + 6*6*6 + color, color)
|
||||||
}
|
}
|
||||||
print "";
|
print "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -eu
|
||||||
|
|
||||||
script_dir="$(dirname "$0")"
|
script_dir="$(dirname "$0")"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -eu
|
||||||
|
|
||||||
script_dir="$(dirname "$0")"
|
script_dir="$(dirname "$0")"
|
||||||
cols="$(tput cols)"
|
cols="$(tput cols)"
|
||||||
|
|
7
scripts/colortest3
Executable file
7
scripts/colortest3
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
script_dir="$(dirname "$0")"
|
||||||
|
|
||||||
|
exec awk -v OPT_COLOR_CODES=1 -f "${script_dir}/../script-resources/colortest.awk"
|
Loading…
Add table
Add a link
Reference in a new issue