Raxol.Terminal.ANSI.SGRProcessor (Raxol v2.0.1)

View Source

Processes SGR (Select Graphic Rendition) ANSI escape sequences.

SGR sequences control text formatting attributes like colors, bold, italic, etc. This module handles parsing SGR parameters and updating terminal styles accordingly.

Summary

Functions

Handles SGR parameters and updates the style state.

Process SGR codes with parsed parameters.

Functions

handle_sgr(params, style)

@spec handle_sgr(String.t(), any()) :: map()

Handles SGR parameters and updates the style state.

Parameters

  • params: String of SGR parameters (e.g., "31", "1;4;31;48;5;196")
  • style: Current style state (can be nil or a map)

Returns

Updated style map

process_sgr_codes(codes, style)

@spec process_sgr_codes([integer()], map()) :: map()

Process SGR codes with parsed parameters.

Parameters

  • codes: List of integer SGR codes
  • style: Current style map

Returns

Updated style map