6 lines
204 B
Python
6 lines
204 B
Python
def hex_to_rgb(hex: str):
|
|
hex = hex.lstrip("#")
|
|
return tuple(int(hex[i:i+2], 16) for i in (0, 2, 4))
|
|
|
|
def rgb_to_hex(r: int, g: int, b: int):
|
|
return f"#{int(r):0>2x}{int(g):0>2x}{int(b):0>2x}" |