Skip to content

Instantly share code, notes, and snippets.

@kuwa72
Created February 23, 2017 08:40
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuwa72/753f8ae998a84dda184c21cc874bd694 to your computer and use it in GitHub Desktop.
Save kuwa72/753f8ae998a84dda184c21cc874bd694 to your computer and use it in GitHub Desktop.
すごーい!!ターミナル
#!/bin/sh
perl -pe 's/(\S)(\S)?(\S)?(\S)?(\S)?(\S)?(\S)?(\S)?(\S)?(\S)?(\S)?(\S)?(\S)?/\x1b[48;5;231m\x1b[38;5;35m$1\x1b[38;5;76m$2\x1b[38;5;208m$3\x1b[38;5;202m$4\x1b[38;5;30m$5\x1b[38;5;162m$6\x1b[38;5;25m$7\x1b[38;5;39m$8\x1b[38;5;245m$9\x1b[38;5;208m$10\x1b[38;5;160m$11\x1b[38;5;160m$12\x1b[38;5;54m$13/g'
@kuwa72
Copy link
Author

kuwa72 commented Feb 23, 2017

Ruby one-liner.

ruby -pe 'BEGIN{$i=0;$c=%w(35 76 208 202 30 162 25 39 245 208 160 160 54)};gsub(/./){|m|$i+=1;"\e[48;5;231m\e[38;5;%sm%s"%[$c[$i%13],m];}'

@kuwa72
Copy link
Author

kuwa72 commented Feb 24, 2017

awk one-liner.

awk 'BEGIN{FS="";split("35 76 208 202 30 162 25 39 245 208 160 160 54",c," ")}{for(i=1;i<=NF;i++)printf "\x1b[48;5;231m\x1b[38;5;%sm%s",c[i%13],$i;print ""}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment