ColorTerm
Module: terminaltexteffects.utils.colorterm
Convert xterm color codes and hex colors into ANSI escape sequences.
Functions:
| Name | Description |
|---|---|
fg |
str | int) -> str: Set the foreground color of the terminal text. |
bg |
str | int) -> str: Set the background color of the terminal text. |
bg(color_code)
Set 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)
Set 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. |