Functions
_should_use_colors
0
bool
▼
Check if terminal supports colors and user allows them.
**Respects:**
- NO_COL…
_should_use_colors
0
bool
▼
def _should_use_colors() -> bool
Check if terminal supports colors and user allows them.
Respects:
- NO_COLOR environment variable (https://no-color.org/)
- FORCE_COLOR environment variable (overrides NO_COLOR)
- sys.stdout.isatty() for TTY detection
Returns
bool
supports_color
0
bool
▼
Check if current terminal supports color output.
supports_color
0
bool
▼
def supports_color() -> bool
Returns
bool
colorize
2
str
▼
Apply ANSI color codes to text.
colorize
2
str
▼
def colorize(text: str, *colors: ColorName) -> str
Parameters
| Name | Type | Description |
|---|---|---|
text |
str |
Text to colorize *colors: One or more color names to apply |
*colors |
ColorName |
Returns
str
strip_colors
1
str
▼
Remove ANSI color codes from text.
strip_colors
1
str
▼
def strip_colors(text: str) -> str
Parameters
| Name | Type | Description |
|---|---|---|
text |
str |
Text potentially containing ANSI codes |
Returns
str
error_code
1
str
▼
Color text as an error code (bright red + bold).
error_code
1
str
▼
def error_code(text: str) -> str
Parameters
| Name | Type | Description |
|---|---|---|
text |
str |
Returns
str
location
1
str
▼
Color text as a file location (cyan).
location
1
str
▼
def location(text: str) -> str
Parameters
| Name | Type | Description |
|---|---|---|
text |
str |
Returns
str
line_number
1
str
▼
Color text as a line number (yellow).
line_number
1
str
▼
def line_number(text: str) -> str
Parameters
| Name | Type | Description |
|---|---|---|
text |
str |
Returns
str
error_line
1
str
▼
Color text as an error line (bright red).
error_line
1
str
▼
def error_line(text: str) -> str
Parameters
| Name | Type | Description |
|---|---|---|
text |
str |
Returns
str
hint
1
str
▼
Color text as a hint/suggestion (green).
hint
1
str
▼
def hint(text: str) -> str
Parameters
| Name | Type | Description |
|---|---|---|
text |
str |
Returns
str
suggestion
1
str
▼
Color text as a 'Did you mean?' suggestion (bright_green + bold).
suggestion
1
str
▼
def suggestion(text: str) -> str
Parameters
| Name | Type | Description |
|---|---|---|
text |
str |
Returns
str
dim_text
1
str
▼
Color text as dimmed/secondary (dim).
dim_text
1
str
▼
def dim_text(text: str) -> str
Parameters
| Name | Type | Description |
|---|---|---|
text |
str |
Returns
str
docs_url
1
str
▼
Color text as a documentation URL (bright_blue).
docs_url
1
str
▼
def docs_url(text: str) -> str
Parameters
| Name | Type | Description |
|---|---|---|
text |
str |
Returns
str
format_error_header
2
str
▼
Format error header with optional code.
format_error_header
2
str
▼
def format_error_header(code: str | None, message: str) -> str
Parameters
| Name | Type | Description |
|---|---|---|
code |
str | None |
Optional error code (e.g., "K-RUN-001") |
message |
str |
Error message |
Returns
str
format_source_line
4
str
▼
Format a source line with colors.
format_source_line
4
str
▼
def format_source_line(lineno: int, content: str, is_error: bool = False, show_marker: bool = True) -> str
Parameters
| Name | Type | Description |
|---|---|---|
lineno |
int |
Line number |
content |
str |
Line content |
is_error |
bool |
True if this is the error line Default:False
|
show_marker |
bool |
True to show '>' marker for error line Default:True
|
Returns
str