Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

optimized strip_hash with 1.96x (196%) speedup (#3242)

Siddf3f7bb63ef7a
diff --git a/kornia/utils/image_print.py b/kornia/utils/image_print.py
index 34eddf857..5fa58fcae 100644
--- a/kornia/utils/image_print.py
+++ b/kornia/utils/image_print.py
@@ -306,10 +306,7 @@ def _str2hex(hexstr: str) -> int:
def _strip_hash(rgb: str) -> str:
- # Strip leading `#` if exists.
- if rgb.startswith("#"):
- rgb = rgb.lstrip("#")
- return rgb
+ return rgb.removeprefix("#")
def short2rgb(short: str) -> str: