Skip to content

Instantly share code, notes, and snippets.

@tadzik
Created August 5, 2011 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tadzik/1128691 to your computer and use it in GitHub Desktop.
Save tadzik/1128691 to your computer and use it in GitHub Desktop.
┌─[tadzik@yavin4]─[~/src/nom] (nom)
└─[%]─> cat foo.pl
#= Color screen output using ANSI escape sequences
module Term::ANSIColor;
#= emit ANSI sequence for the given string of attributes
sub color (Str $what) is export { ... }
#= color the text according to the description
sub colored (Str $what, Str $how) is export { ... }
#= is the color valid?
sub colorvalid (*@a) is export { ... }
#= string colors from the string
sub colorstrip (*@a) is export { ... }
#= transform ANSI sequences into their string descriptions
sub uncolor (Str $what) is export { ... }
DOC INIT {
use Pod::To::Text;
print pod2text($=POD)
}
┌─[tadzik@yavin4]─[~/src/nom] (nom)
└─[%]─> ./perl6 --doc foo.pl
sub color: emit ANSI sequence for the given string of attributes
sub colored: color the text according to the description
sub colorvalid: is the color valid?
sub colorstrip: string colors from the string
sub uncolor: transform ANSI sequences into their string descriptions
module Term::ANSIColor: Color screen output using ANSI escape sequences
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment