Skip to content

Commit

Permalink
Extend example.pl a bit
Browse files Browse the repository at this point in the history
* Show use of 256-color and 24-bit color extensions
* Show use of colorstrip() and uncolor()
  • Loading branch information
japhb committed Nov 6, 2016
1 parent c95c318 commit fa54d8f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions example.pl
Expand Up @@ -7,3 +7,15 @@
"Hey, isn't it awesome?", color('reset');
say colored("IM IN UR MODULE MESSING WITH UR COLOURS",
"bold green on_blue");

# 256-color support: '196 on_54'
my $psych = "Yo, I got your psychedelia right here!"
.words.map({ colored("$_ ", "{(^256).pick} on_{(^256).pick}") }).join;
say $psych;
say colorstrip($psych);

# 24-bit support
my $escapes = color('255,255,0 on_187,0,0');
my $description = uncolor($escapes);
say "'$description' encodes to:";
say $escapes.perl;

0 comments on commit fa54d8f

Please sign in to comment.