API Reference
clean
def clean(string: str, marker: str = "&") -> str
clean_ansi
def clean_ansi(string: str, marker: str = "&") -> str
Dahlia
DepthInt = Literal[3, 4, 8, 24]
class Dahlia(
*,
depth: Depth | DepthInt | str | None = None,
marker: str = "&",
auto_reset: bool = True,
)
Dahlia
class. Accepts the following arguments:
depth
: the color depth1 to use for styling; whenNone
, Dahlia will try to detect the color depth of the current terminal emulator (Depth.LOW
will be used as a fallback). The detected depth can be accessed through thedepth
property (will stayNone
ifNO_COLOR=1
orTERM=dumb
); defaults toNone
marker
: the character used to mark the beginning of a Dahlia formatting code; must be a single character; defaults to&
auto_reset
: whether to automatically reset the formatting at the end of a string; defaults toTrue
Dahlia instances are comparable and hashable.
Dahlia.convert
def convert(self, string: str) -> str
Dahlia.input
def input(self, prompt: str) -> str
input
by transforming2 the prompt.
Dahlia.print
def print(self, *args: object, **kwargs: Any) -> None
print
by transforming2 all positional arguments and
passing through all keyword arguments.
Depth
class Depth(Enum):
TTY = 3
LOW = 4
MEDIUM = 8
HIGH = 24