- printf "tput -T%s initc %d %d %d %d\n", myterm, $1,scaled($2),scaled($3),scaled($4);
-}' |sh -
+ item = $1 + 0;
+ if (range < item) {
+ range = item;
+ }
+ params[$1] = sprintf ("%d %d %d", scaled($2),scaled($3),scaled($4));
+}
+END {
+ for (n = 0; n <= range; ++n) {
+ m = n;
+ if ( opt_r == "yes" ) {
+ if ( colors <= 16 ) {
+ m = range - n;
+ } else if ( ( opt_s == "yes" ) && ( n < 16 ) ) {
+ m = 15 - n;
+ } else if ( n >= cramp ) {
+ m = cramp + colors - 1 - n;
+ } else {
+ m = 16 + cramp - 1 - n;
+ }
+ }
+ printf "tput -T%s initc %d %s\n", myterm, m, params[n];
+ }
+}
+' |sh -