Raxol.Terminal.StyleManager (Raxol v2.0.1)

View Source

Manages terminal style operations including colors, attributes, and formatting. This module is responsible for handling all style-related operations in the terminal.

Summary

Functions

Applies a style to a region. Returns the updated emulator.

Gets the style buffer instance. Returns the style buffer.

Gets the default style. Returns the default style map.

Gets the current style. Returns the current style map.

Gets the style at a specific position. Returns the style map at that position.

Merges two styles. Returns the merged style map.

Resets the style to default. Returns the updated emulator.

Sets text attributes. Returns the updated emulator.

Sets the background color. Returns the updated emulator.

Sets the default style. Returns the updated emulator.

Sets the foreground color. Returns the updated emulator.

Updates the style buffer instance. Returns the updated emulator.

Validates a style map. Returns :ok or {:error, reason}.

Functions

apply_style_to_region(emulator, start, end_, style)

Applies a style to a region. Returns the updated emulator.

get_buffer(emulator)

Gets the style buffer instance. Returns the style buffer.

get_default_style(emulator)

Gets the default style. Returns the default style map.

get_style(emulator)

Gets the current style. Returns the current style map.

get_style_at(emulator, x, y)

Gets the style at a specific position. Returns the style map at that position.

merge_styles(style1, style2)

Merges two styles. Returns the merged style map.

reset_style(emulator)

Resets the style to default. Returns the updated emulator.

set_attributes(emulator, attributes)

@spec set_attributes(Raxol.Terminal.Emulator.t(), [atom()]) ::
  Raxol.Terminal.Emulator.t()

Sets text attributes. Returns the updated emulator.

set_background(emulator, color)

Sets the background color. Returns the updated emulator.

set_default_style(emulator, style)

Sets the default style. Returns the updated emulator.

set_foreground(emulator, color)

Sets the foreground color. Returns the updated emulator.

update_buffer(emulator, buffer)

Updates the style buffer instance. Returns the updated emulator.

validate_style(style)

@spec validate_style(Raxol.Terminal.StyleBuffer.style()) :: :ok | {:error, String.t()}

Validates a style map. Returns :ok or {:error, reason}.