Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:josip/kano
Conflicts: io/Utilites.io
- Loading branch information
Showing
2 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/*doc Sequence colourize(colour[, option]) | ||
Prints the string to stdout with bash colors.<br/> | ||
Example: "Fire!!!" colourize("red", "bold") printlnColours | ||
*/ | ||
Sequence colours := list("black", "red", "green", "yellow", "blue", "purple", "cyan", "white") | ||
Sequence colourize := method(colour, option, | ||
out := "\\e[" asMutable | ||
if(colour isNil, out appendSeq("0;3")) | ||
if(option == "bold", out appendSeq("1;3")) | ||
if(option == "underline", out appendSeq("4;3")) | ||
if(option == "background", out appendSeq("4")) | ||
|
||
out appendSeq(self colours indexOf(colour) .. "m") | ||
out appendSeq(self) | ||
out appendSeq("\\e[0m") | ||
|
||
out) | ||
|
||
(System platform asLowercase == "darwin") ifFalse( | ||
Sequence colourize = method(self)) | ||
|
||
Sequence printlnColours := method( | ||
System system("echo \"#{self}\"" interpolate) | ||
self) | ||
|