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")
"[1;45;33mHello World[0m"
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
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.
iex> Termite.Style.bold()
...> |> Termite.Style.render_to_string("Hello")
"[1mHello[0m"
Output the reset code.
iex> Termite.Style.reset_code()
"[0m"
Set the text style to inverse (swap foreground/background colors).
Set the text style to underline.