File: colorize_spesh.p6

package info (click to toggle)
moarvm 2018.12%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 18,196 kB
  • sloc: ansic: 223,172; perl: 7,638; sh: 4,452; makefile: 1,089; python: 568; asm: 8
file content (12 lines) | stat: -rwxr-xr-x 405 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env perl6

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
}