Raxol.Terminal.Style.Manager (Raxol v2.0.1)
View SourceManages text styling and formatting for the terminal emulator. This module provides a clean interface for managing text styles, colors, and attributes.
Summary
Functions
Converts an ANSI color code to a color name.
Applies a text attribute to the style.
Calculates the effective width of a character based on the current style.
Formats SGR parameters for DECRQSS responses.
Gets the background color.
Gets the current style.
Gets the foreground color.
Gets the hyperlink URI.
Creates a new text style with default values.
Resets to single-width, single-height mode.
Resets all text formatting attributes to their default values.
Sets the background color.
Sets double-height bottom half mode for the current line.
Sets double-height top half mode for the current line.
Sets double-width mode for the current line.
Sets the foreground color.
Sets a hyperlink URI.
Sets the style to a new value.
Types
@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
@type text_style() :: %{ background: color(), blink: boolean(), bold: boolean(), conceal: boolean(), double_height: :bottom | :none | :top, double_underline: boolean(), double_width: boolean(), encircled: boolean(), faint: boolean(), foreground: color(), fraktur: boolean(), framed: boolean(), hyperlink: nil | binary(), italic: boolean(), overlined: boolean(), reverse: boolean(), strikethrough: boolean(), underline: boolean() }
Functions
Converts an ANSI color code to a color name.
@spec apply_style(text_style(), atom()) :: text_style()
Applies a text attribute to the style.
@spec effective_width(text_style(), String.t()) :: non_neg_integer()
Calculates the effective width of a character based on the current style.
@spec format_sgr_params(text_style()) :: String.t()
Formats SGR parameters for DECRQSS responses.
@spec get_background(text_style()) :: color()
Gets the background color.
@spec get_current_style(text_style()) :: text_style()
Gets the current style.
@spec get_foreground(text_style()) :: color()
Gets the foreground color.
@spec get_hyperlink(text_style()) :: String.t() | nil
Gets the hyperlink URI.
@spec new() :: Raxol.Terminal.ANSI.TextFormatting.t()
Creates a new text style with default values.
@spec reset_size(text_style()) :: Raxol.Terminal.ANSI.TextFormatting.t()
Resets to single-width, single-height mode.
@spec reset_style(text_style()) :: Raxol.Terminal.ANSI.TextFormatting.t()
Resets all text formatting attributes to their default values.
@spec set_background(text_style(), color()) :: text_style()
Sets the background color.
@spec set_double_height_bottom(text_style()) :: Raxol.Terminal.ANSI.TextFormatting.t()
Sets double-height bottom half mode for the current line.
@spec set_double_height_top(text_style()) :: Raxol.Terminal.ANSI.TextFormatting.t()
Sets double-height top half mode for the current line.
@spec set_double_width(text_style()) :: Raxol.Terminal.ANSI.TextFormatting.t()
Sets double-width mode for the current line.
@spec set_foreground(text_style(), color()) :: text_style()
Sets the foreground color.
@spec set_hyperlink(text_style(), String.t() | nil) :: text_style()
Sets a hyperlink URI.
@spec set_style(text_style(), text_style()) :: text_style()
Sets the style to a new value.