Sets primary (default) font
Elixir v1.0.5 IO.ANSI
Functionality to render ANSI escape sequences (http://en.wikipedia.org/wiki/ANSI_escape_code) — characters embedded in text used to control formatting, color, and other output options on video text terminals.
Summary
Functions
Sets foreground color to black
Sets background color to black
Blink: off
Blink: Rapid. MS-DOS ANSI.SYS; 150 per minute or more; not widely supported
Blink: Slow. Less than 150 per minute
Sets foreground color to blue
Sets background color to blue
Bright (increased intensity) or Bold
Clear screen
Conceal. Not widely supported
Crossed-out. Characters legible, but marked for deletion. Not widely supported
Sets foreground color to cyan
Sets background color to cyan
Default background color
Default text color
Checks if ANSI coloring is supported and enabled on this machine
Encircled
Faint (decreased intensity), not widely supported
Sets alternative font 1
Sets alternative font 2
Sets alternative font 3
Sets alternative font 4
Sets alternative font 5
Sets alternative font 6
Sets alternative font 7
Sets alternative font 8
Sets alternative font 9
Formats a chardata-like argument by converting named ANSI sequences into actual ANSI codes
Formats a chardata-like argument by converting named ANSI sequences into actual ANSI codes
Framed
Sets foreground color to green
Sets background color to green
Send cursor home
Image: Negative. Swap foreground and background
Italic: on. Not widely supported. Sometimes treated as inverse
Sets foreground color to magenta
Sets background color to magenta
Underline: None
Normal color or intensity
Not framed or encircled
Not italic
Not overlined
Overlined
Sets primary (default) font
Sets foreground color to red
Sets background color to red
Resets all attributes
Image: Negative. Swap foreground and background
Underline: Single
Sets foreground color to white
Sets background color to white
Sets foreground color to yellow
Sets background color to yellow
Types
ansidata :: ansilist | ansicode | binary
Functions
Specs
enabled? :: boolean
Checks if ANSI coloring is supported and enabled on this machine.
This function simply reads the configuration value for
:ansi_enabled
in the :elixir
application. The value is by
default false unless Elixir can detect during startup that
both stdout
and stderr
are terminals.
Formats a chardata-like argument by converting named ANSI sequences into actual ANSI codes.
The named sequences are represented by atoms.
It will also append an IO.ANSI.reset
to the chardata when a conversion is
performed. If you don’t want this behaviour, use format_fragment/2
.
An optional boolean parameter can be passed to enable or disable
emitting actual ANSI codes. When false
, no ANSI codes will emitted.
By default checks if ANSI is enabled using the enabled?/0
function.
Examples
iex> IO.ANSI.format(["Hello, ", :red, :bright, "world!"], true)
[[[[[[], "Hello, "] | "\e[31m"] | "\e[1m"], "world!"] | "\e[0m"]
Formats a chardata-like argument by converting named ANSI sequences into actual ANSI codes.
The named sequences are represented by atoms.
An optional boolean parameter can be passed to enable or disable
emitting actual ANSI codes. When false
, no ANSI codes will emitted.
By default checks if ANSI is enabled using the enabled?/0
function.
Examples
iex> IO.ANSI.format_fragment([:bright, 'Word'], true)
[[[[[[] | "\e[1m"], 87], 111], 114], 100]