View Source Termite.Style (Termite v0.3.0)

This module contains functions for building up a styled input.

The functions in this module are intended to be chained. For example:

iex> Termite.Style.background(5)
...> |> Termite.Style.foreground(3)
...> |> Termite.Style.bold()
...> |> Termite.Style.render_to_string("Hello World")
"Hello World"

Summary

Functions

Change the style type to ansi256 for extended colors.

Change the style type to ansi. This is the default value.

Set the background color. This can be a value up to 16 for :ansi or up to 255 for :ansi256.

Set the text style to blink.

Set the text style to bold.

Set the text style to strikethrough.

Set the text style to dim/faint.

Set the foreground (text) color. This can be a value up to 16 for :ansi or up to 255 for :ansi256.

Set the text style to inverse (swap foreground/background colors).

Set the text style to italic.

Render a string with the specified styles. And a reset code.

Output the reset code.

Set the text style to inverse (swap foreground/background colors).

Set the text style to underline.

Functions

Link to this function

ansi256(style \\ %Style{})

View Source

Change the style type to ansi256 for extended colors.

Change the style type to ansi. This is the default value.

Link to this function

background(style \\ %Style{}, color)

View Source

Set the background color. This can be a value up to 16 for :ansi or up to 255 for :ansi256.

Link to this function

blink(style \\ %Style{})

View Source

Set the text style to blink.

Set the text style to bold.

Link to this function

crossed_out(style \\ %Style{})

View Source

Set the text style to strikethrough.

Link to this function

faint(style \\ %Style{})

View Source

Set the text style to dim/faint.

Link to this function

foreground(style \\ %Style{}, color)

View Source

Set the foreground (text) color. This can be a value up to 16 for :ansi or up to 255 for :ansi256.

Link to this function

inverse(style \\ %Style{})

View Source

Set the text style to inverse (swap foreground/background colors).

Link to this function

italic(style \\ %Style{})

View Source

Set the text style to italic.

Link to this function

render_to_string(style \\ %Style{}, str)

View Source

Render a string with the specified styles. And a reset code.

iex> Termite.Style.bold()
...> |> Termite.Style.render_to_string("Hello")
"Hello"

Output the reset code.

iex> Termite.Style.reset_code()
""
Link to this function

reverse(style \\ %Style{})

View Source

Set the text style to inverse (swap foreground/background colors).

Link to this function

underline(style \\ %Style{})

View Source

Set the text style to underline.