Anansi v0.0.1 Anansi.Text

ANSI escape codes that format, color, and change the font of terminal text.

Summary

Functions

Sets the text color to :black where context is :foreground or :background

Sets :blink format to state :on or :off

Sets the text color to :blue where context is :foreground or :background

Sets bold format to state :on or :off

Sets the foreground text color to color

Sets the text color to color where context is :foreground or :background

Sets conceal format to state :on or :off

Sets the text color to :cyan where context is :foreground or :background

Sets faint format to state :on or :off

Sets the text font to an alternate font if available

Activates text to display with given format

Sets format format to state :on or :off

Sets the text color to :green where context is :foreground or :background

Sets invert format to state :on or :off

Sets italic format to state :on or :off

Sets the text color to :magenta where context is :foreground or :background

Sets the text color to :red where context is :foreground or :background

Resets text formatting, font, and color

Sets reveal format to state :on or :off

Sets strikethrough format to state :on or :off

Sets underline format to state :on or :off

Sets the text color to :white where context is :foreground or :background

Convenience function to insert io data into a sequence via Anansi.Sequence.compose/1

Sets the text color to :yellow where context is :foreground or :background

Functions

black(context \\ :foreground)

Sets the text color to :black where context is :foreground or :background.

blink(state \\ :on)

Sets :blink format to state :on or :off.

Supported states: :on, :slow, :fast, :off.

The default :on state is equivalent to :slow to keep parity with other format functions.

blue(context \\ :foreground)

Sets the text color to :blue where context is :foreground or :background.

bold(state \\ :on)

Sets bold format to state :on or :off.

color(color)

Sets the foreground text color to color.

Supported colors: :black, :red, :green, :yellow, :blue, :magenta, :cyan, :white, :default.

See color/2 to set the background instead.

You can also set the color to a specific value in the range 0..256 or to an {r, g, b} tuple where each element is also in the range 0..256.

Alternatively, the color can be a keyword list to set both foreground and background in one go via color/2.

color(color, context)

Sets the text color to color where context is :foreground or :background.

Supported colors: :black, :red, :green, :yellow, :blue, :magenta, :cyan, :white, :default.

You can also set the color to a specific value in the range 0..256 or to an {r, g, b} tuple where each element is in the range 0..256.

conceal(state \\ :on)

Sets conceal format to state :on or :off.

cyan(context \\ :foreground)

Sets the text color to :cyan where context is :foreground or :background.

faint(state \\ :on)

Sets faint format to state :on or :off.

font(font)

Sets the text font to an alternate font if available.

Supported fonts are in the range 0..9 where 0 is the default font and 1..9 correspond to the available alternate fonts.

The :default type is equivalent to font type 0.

format(format)

Activates text to display with given format.

Supported formats: :bold, :faint, :italic, :underline, :invert, :conceal, :strikethrough, :reveal, :blink.

The :blink format is set to :slow rather than :fast, this can be controlled via format/2.

Alternatively, the format can be a keyword list of formats and states to use via format/2.

format(format, state)

Sets format format to state :on or :off.

Supported formats: :bold, :faint, :italic, :underline, :invert, :conceal, :strikethrough, :reveal, :blink.

You can also use the :blink format with ‘:slow’ or ‘:fast’; :on corresponds to :slow.

green(context \\ :foreground)

Sets the text color to :green where context is :foreground or :background.

invert(state \\ :on)

Sets invert format to state :on or :off.

italic(state \\ :on)

Sets italic format to state :on or :off.

magenta(context \\ :foreground)

Sets the text color to :magenta where context is :foreground or :background.

red(context \\ :foreground)

Sets the text color to :red where context is :foreground or :background.

reset()

Resets text formatting, font, and color.

reveal(state \\ :on)

Sets reveal format to state :on or :off.

strikethrough(state \\ :on)

Sets strikethrough format to state :on or :off.

underline(state \\ :on)

Sets underline format to state :on or :off.

white(context \\ :foreground)

Sets the text color to :white where context is :foreground or :background.

write(text)

Convenience function to insert io data into a sequence via Anansi.Sequence.compose/1.

yellow(context \\ :foreground)

Sets the text color to :yellow where context is :foreground or :background.