colorize
NOTE: this is a exported version of ruby gem colorize.
1 Procedure Reference
procedure
(colorize str color1 #:background color2 #:style style) → string? str : string? color1 : symbol? color2 : symbol? style : symbol?
procedure
(colorize/argv sym) → list?
sym : symbol?
procedure
(colorized? str) → boolean?
str : string?
2 Usage Example
> (require colorize) > (colorize/argv 'color)
'(black
light-black
red
light-red
green
light-green
yellow
light-yellow
blue
light-blue
magenta
light-magenta
cyan
light-cyan
white
light-white
default)
> (colorize/argv 'style) '(default bold italic underline blink swap hide)
> (colorize/argv 'all)
'((color
black
light-black
red
light-red
green
light-green
yellow
light-yellow
blue
light-blue
magenta
light-magenta
cyan
light-cyan
white
light-white
default)
(style default bold italic underline blink swap hide))
> (colorize "this is a raw red string" 'red) "\e[0;31;49mthis is a raw red string\e[0m"
; below is an example about how to display the the red string to your terminal > (displayln (colorize "this is a raw red string" 'red)) [0;31;49mthis is a raw red string[0m
> (colorize "this is a raw red string on blue with underline" 'red #:background 'blue #:style 'underline) "\e[4;31;44mthis is a raw red string on blue with underline\e[0m"
; a practical usage example shown below:
> (string-join `("\n" ,(colorize "Happy" 'light-red) ,(colorize "Hacking" 'blue) ,(colorize (string-titlecase (getenv "USER")) 'green) "-" ,(colorize "Racket" 'cyan) ,(colorize "♥" 'magenta) ,(colorize "You" 'light-magenta) ,(colorize "!!!" 'red) "\n\n") " ") string-titlecase: contract violation
expected: string?
given: #f