Created
November 26, 2019 18:00
-
-
Save Perlence/b841999bb2ce00a62d42f5dbd7ca74c5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/awk -f | |
BEGIN { | |
# first the system ones: | |
print "System colors:" | |
for (color = 0; color < 8; color++) { | |
printf "\x1b[48;5;" color "m " | |
} | |
print "\x1b[0m" | |
for (color = 8; color < 16; color++) { | |
printf "\x1b[48;5;" color "m " | |
} | |
print "\x1b[0m" | |
# now the color cube | |
print "Color cube, 6x6x6:" | |
for (green = 0; green < 6; green++) { | |
for (red = 0; red < 6; red++) { | |
for (blue = 0; blue < 6; blue++) { | |
color = 16 + (red * 36) + (green * 6) + blue | |
printf "\x1b[48;5;" color "m " | |
} | |
printf "\x1b[0m " | |
} | |
print "" | |
} | |
# now the grayscale ramp | |
print "Grayscale ramp:" | |
for (color = 232; color < 256; color++) { | |
printf "\x1b[48;5;" color "m " | |
} | |
print "\x1b[0m" | |
# now the true color | |
print "True color:" | |
for (colnum = 0; colnum < 77; colnum++) { | |
r = 255 - (colnum * 255 / 76) | |
g = colnum * 510 / 76 | |
b = colnum * 255 / 76 | |
if (g > 255) g = 510 - g | |
printf "\x1b[48;2;%d;%d;%dm", r, g, b | |
printf "\x1b[38;2;%d;%d;%dm", 255 - r, 255 - g, 255 - b | |
printf " \x1b[0m" | |
} | |
print "\x1b[0m" | |
print "Font styles:" | |
print "\x1b[1mbold\x1b[0m" | |
print "\x1b[3mitalic\x1b[0m" | |
print "\x1b[4munderline\x1b[0m" | |
print "\x1b[9mstrikethrough\x1b[0m" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment