hl183

TERM COLORs

Jul 10th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. for i in {0..255}; do
  2. printf "\x1b[38;5;${i}mcolour${i}\x1b[0m\n"
  3. done
  4. ###############################################################
  5.  
  6.  
  7. #!/bin/bash
  8. # Based on: https://gist.github.com/XVilka/8346728
  9.  
  10. awk -v term_cols="${width:-$(tput cols || echo 80)}" 'BEGIN{
  11. s="/\\";
  12. for (colnum = 0; colnum<term_cols; colnum++) {
  13. r = 255-(colnum*255/term_cols);
  14. g = (colnum*510/term_cols);
  15. b = (colnum*255/term_cols);
  16. if (g>255) g = 510-g;
  17. printf "\033[48;2;%d;%d;%dm", r,g,b;
  18. printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
  19. printf "%s\033[0m", substr(s,colnum%2+1,1);
  20. }
  21. printf "\n";
  22. }'
Advertisement
Add Comment
Please, Sign In to add comment