Raxol.Terminal.ANSI.Behaviours.TextFormatting behaviour (Raxol Terminal v2.6.0)

Copy Markdown View Source

Defines the behaviour for text formatting in the terminal. This includes handling text attributes, colors, and special text modes.

Summary

Types

color()

@type color() ::
  :black
  | :red
  | :green
  | :yellow
  | :blue
  | :magenta
  | :cyan
  | :white
  | {:rgb, non_neg_integer(), non_neg_integer(), non_neg_integer()}
  | {:index, non_neg_integer()}
  | nil

text_style()

@type text_style() :: map()

Callbacks

apply_attribute(text_style, atom)

@callback apply_attribute(text_style(), atom()) :: text_style()

get_background(text_style)

@callback get_background(text_style()) :: color()

get_foreground(text_style)

@callback get_foreground(text_style()) :: color()

new()

@callback new() :: text_style()

reset_attributes(text_style)

@callback reset_attributes(text_style()) :: text_style()

reset_blink(text_style)

@callback reset_blink(text_style()) :: text_style()

reset_bold(text_style)

@callback reset_bold(text_style()) :: text_style()

reset_framed_encircled(text_style)

@callback reset_framed_encircled(text_style()) :: text_style()

reset_italic(text_style)

@callback reset_italic(text_style()) :: text_style()

reset_overlined(text_style)

@callback reset_overlined(text_style()) :: text_style()

reset_reverse(text_style)

@callback reset_reverse(text_style()) :: text_style()

reset_size(text_style)

@callback reset_size(text_style()) :: text_style()

reset_underline(text_style)

@callback reset_underline(text_style()) :: text_style()

set_attributes(text_style, list)

@callback set_attributes(text_style(), [atom()]) :: text_style()

set_background(text_style, color)

@callback set_background(text_style(), color()) :: text_style()

set_blink(text_style)

@callback set_blink(text_style()) :: text_style()

set_bold(text_style)

@callback set_bold(text_style()) :: text_style()

set_conceal(text_style)

@callback set_conceal(text_style()) :: text_style()

set_custom(text_style, atom, any)

@callback set_custom(text_style(), atom(), any()) :: text_style()

set_double_height_bottom(text_style)

@callback set_double_height_bottom(text_style()) :: text_style()

set_double_height_top(text_style)

@callback set_double_height_top(text_style()) :: text_style()

set_double_underline(text_style)

@callback set_double_underline(text_style()) :: text_style()

set_double_width(text_style)

@callback set_double_width(text_style()) :: text_style()

set_encircled(text_style)

@callback set_encircled(text_style()) :: text_style()

set_faint(text_style)

@callback set_faint(text_style()) :: text_style()

set_foreground(text_style, color)

@callback set_foreground(text_style(), color()) :: text_style()

set_fraktur(text_style)

@callback set_fraktur(text_style()) :: text_style()

set_framed(text_style)

@callback set_framed(text_style()) :: text_style()

set_hyperlink(text_style, arg2)

@callback set_hyperlink(text_style(), String.t() | nil) :: text_style()

set_italic(text_style)

@callback set_italic(text_style()) :: text_style()

set_overlined(text_style)

@callback set_overlined(text_style()) :: text_style()

set_reverse(text_style)

@callback set_reverse(text_style()) :: text_style()

set_strikethrough(text_style)

@callback set_strikethrough(text_style()) :: text_style()

set_underline(text_style)

@callback set_underline(text_style()) :: text_style()

update_attrs(text_style, map)

@callback update_attrs(text_style(), map()) :: text_style()

validate(text_style)

@callback validate(text_style()) :: {:ok, text_style()} | {:error, String.t()}