Patch module
Examples¶
Patch Rich's Color.parse at runtime to add CSS name and 3-digit hex support:
from rich_color_ext.patch import install, uninstall, is_installed
install()
assert is_installed()
# ... use Rich with CSS colours here ...
uninstall()
assert not is_installed()
API reference¶
Monkey-patching support for rich.color.Color.parse.
install()
¶
Install the monkey patch. After this call, rich.color.Color.parse will support 3‐digit hex and CSS colour names. Safe to call multiple times.
Source code in src/rich_color_ext/patch.py
is_installed()
¶
uninstall()
¶
Uninstall the monkey patch, restoring the original rich.color.Color.parse. Safe to call multiple times.