view tools/colorize_spesh.p6 @ 42:dc42e7eb1adf

delte '-fno-optimize-sibling-calls' optin to use use clang in compilation
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Thu, 29 Nov 2018 19:43:32 +0900
parents 2cf249471370
children
line wrap: on
line source

sub colorblock($num, $ver) {
    "\e[48;5;{ 0x10 + (($num + 1) * 31416) % 216 }m  "
    ~ "\e[38;5;{ 0xE8 + 24 - ($num + $ver * 5) % 24 }m\c[ BLACK LEFT-POINTING TRIANGLE ]"
    ~ "\e[48;5;0m\c[ BLACK RIGHT-POINTING TRIANGLE ]"
    ~ "\e[m"
}

for lines() :eager -> $_ is copy {
    .subst( /r(<.digit>+) '(' (<.digit>+) ')' /, -> $/ { "r$0\($1\)" ~ colorblock($0, $1) }, :g ).say
}