Raxol.Terminal.Style.Manager (Raxol v0.4.0)
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() :: %{ double_width: boolean(), double_height: :none | :top | :bottom, bold: boolean(), faint: boolean(), italic: boolean(), underline: boolean(), blink: boolean(), reverse: boolean(), conceal: boolean(), strikethrough: boolean(), fraktur: boolean(), double_underline: boolean(), foreground: color(), background: color(), hyperlink: String.t() | nil }
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()) :: 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() :: text_style()
Creates a new text style with default values.
@spec reset_size(text_style()) :: text_style()
Resets to single-width, single-height mode.
@spec reset_style(text_style()) :: text_style()
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()) :: text_style()
Sets double-height bottom half mode for the current line.
@spec set_double_height_top(text_style()) :: text_style()
Sets double-height top half mode for the current line.
@spec set_double_width(text_style()) :: text_style()
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.