Skip to content

Instantly share code, notes, and snippets.

@ianbattersby
Created November 12, 2018 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianbattersby/59c730b5995d1d781e5f300ccff961d8 to your computer and use it in GitHub Desktop.
Save ianbattersby/59c730b5995d1d781e5f300ccff961d8 to your computer and use it in GitHub Desktop.
Display full colour range in terminal window
awk 'BEGIN{
s="/\\/\\/\\/\\/\\"; s=s s s s s s s s s s s s s s s s s s s s s s s;
for (colnum = 0; colnum<256; colnum++) {
r = 255-(colnum*255/255);
g = (colnum*510/255);
b = (colnum*255/255);
if (g>255) g = 510-g;
printf "\033[48;2;%d;%d;%dm", r,g,b;
printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
printf "%s\033[0m", substr(s,colnum+1,1);
}
printf "\n";
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment