We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8d4345b commit b78f24bCopy full SHA for b78f24b
rainbow.sh
@@ -0,0 +1,16 @@
1
+#!/bin/bash
2
+# Based on: https://gist.github.com/XVilka/8346728
3
+
4
+awk -v term_cols="${width:-$(tput cols || echo 80)}" 'BEGIN{
5
+ s="/\\";
6
+ for (colnum = 0; colnum<term_cols; colnum++) {
7
+ r = 255-(colnum*255/term_cols);
8
+ g = (colnum*510/term_cols);
9
+ b = (colnum*255/term_cols);
10
+ if (g>255) g = 510-g;
11
+ printf "\033[48;2;%d;%d;%dm", r,g,b;
12
+ printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
13
+ printf "%s\033[0m", substr(s,colnum%2+1,1);
14
+ }
15
+ printf "\n";
16
+}'
0 commit comments