API Reference
clean
def clean(string: str, marker: str = "&") -> str
clean_ansi
def clean_ansi(string: str, marker: str = "&") -> str
escape
def escape(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.LOWwill be used as a fallback). The detected depth can be accessed through thedepthproperty (will stayNoneifNO_COLOR=1orTERM=dumb); defaults toNonemarker: 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