Colorful
This module is a wrapper for IO.ANSI module.
iex> use Colorful
iex> Colorful.string("hello", "red underline")
"[31m[4mhello[0m"
iex> Colorful.string("hello", ["red", "underline"])
"[31m[4mhello[0m"
iex> Colorful.string("hello", [:red, :underline])
"[31m[4mhello[0m"
iex> Colorful.puts("hello", "red")
hello # colored
iex> Colorful.inspect(:hello, "red")
:hello # colored
:hello # return value, an atom
Followings are valid decorators.
red
green
blue
cyan
magenta
yellow
black
white
default_color
red_background
green_background
blue_background
cyan_background
magenta_background
yellow_background
black_background
white_background
default_background
normal
bright
italic
overlined
underline
crossed_out
reverse
inverse
conceal
faint
framed
encircled
blink_slow
blink_rapid
reset
not_italic
not_overlined
no_underline
not_framed_encircled
blink_off
primary_font
font_1
font_2
font_3
font_4
font_5
font_6
font_7
font_8
font_9
home
clear
Summary
inspect(text, decorators \\ "reset") | This writes colored string to stdout.
The string is made of first argument according to |
inspect(device, text, decorators) | Inspects decorated text to specified device |
puts(text, decorators \\ "reset") | This outputs colored string to stdout as same as |
puts(device, text, decorators) | Outputs decorated text to specified device, similar to |
string(text, decorators \\ "reset") | This function makes given string decorated |
Types ↑
decorators :: String.t | [String.t | atom]
Macros
This writes colored string to stdout.
The string is made of first argument according to Inspect
protocol.
This returns given first argument as it is.
This outputs colored string to stdout as same as IO.puts
.
The return value is always :ok
.
Outputs decorated text to specified device, similar to IO.puts/2