ColorTerm
Module: terminaltexteffects.utils.colorterm
This module converts xterm color codes and hex colors into ANSI escape sequences.
bg(color_code)
Sets the background color of the terminal text.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
color_code |
str | int
|
The value to set the background color, as a hex string or X-Term 256 color code. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The ANSI escape sequence to set the background color. |
Source code in terminaltexteffects/utils/colorterm.py
fg(color_code)
Sets the foreground color of the terminal text.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
color_code |
str | int
|
The value to set the foreground color, as a hex string or X-Term 256 color code. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The ANSI escape sequence to set the foreground color. |