Raxol.Terminal.ANSI.Sequences.Colors (Raxol v0.2.0)
View SourceANSI Color Sequence Handler.
Handles parsing and application of ANSI color control sequences, including 16-color mode, 256-color mode, and true color (24-bit) mode.
Summary
Functions
Generate ANSI color code for a given color.
Returns a map of ANSI color codes.
Set background color using 256-color mode.
Set background color using basic 16-color mode.
Set background color using true (24-bit) RGB color.
Set foreground color using 256-color mode.
Set foreground color using basic 16-color mode.
Set foreground color using true (24-bit) RGB color.
Functions
Generate ANSI color code for a given color.
Parameters
color
- The color structtype
- Either :foreground or :background
Returns
ANSI escape sequence as string
Returns a map of ANSI color codes.
Returns
A map of color names to ANSI codes.
Examples
iex> Raxol.Terminal.ANSI.Sequences.Colors.color_codes()
%{
black: "[30m",
red: "[31m",
# ... other colors ...
reset: "[0m"
}
Set background color using 256-color mode.
Parameters
emulator
- The terminal emulator stateindex
- Color index (0-255)
Returns
Updated emulator state
Set background color using basic 16-color mode.
Parameters
emulator
- The terminal emulator statecolor_code
- Color code (0-15)
Returns
Updated emulator state
Set background color using true (24-bit) RGB color.
Parameters
emulator
- The terminal emulator stater
- Red component (0-255)g
- Green component (0-255)b
- Blue component (0-255)
Returns
Updated emulator state
Set foreground color using 256-color mode.
Parameters
emulator
- The terminal emulator stateindex
- Color index (0-255)
Returns
Updated emulator state
Set foreground color using basic 16-color mode.
Parameters
emulator
- The terminal emulator statecolor_code
- Color code (0-15)
Returns
Updated emulator state
Set foreground color using true (24-bit) RGB color.
Parameters
emulator
- The terminal emulator stater
- Red component (0-255)g
- Green component (0-255)b
- Blue component (0-255)
Returns
Updated emulator state