textual.filter
Filter classes.
Note
Filters are used internally, and not recommended for use by Textual app developers.
Filters are used internally to process terminal output after it has been rendered. Currently this is used internally to convert the application to monochrome, when the NO_COLOR env var is set.
In the future, this system will be used to implement accessibility features.
ANSIToTruecolor
¶
ANSIToTruecolor(terminal_theme, enabled=True)
Bases: LineFilter
Convert ANSI colors to their truecolor equivalents.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
TerminalTheme
|
A rich terminal theme. |
required |
apply
¶
apply(segments, background)
DimFilter
¶
DimFilter(dim_factor=0.5)
Bases: LineFilter
Replace dim attributes with modified colors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
float
|
The factor to dim by; 0 is 100% background (i.e. invisible), 1.0 is no change. |
0.5
|
Monochrome
¶
Bases: LineFilter
Convert all colors to monochrome.
NoColor
¶
Bases: LineFilter
Remove all color information from segments.
dim_color
cached
¶
dim_color(background, color, factor)