feat: funcion now correctly converts decimal rgb to hex
This commit is contained in:
parent
e09a44dcd1
commit
dae045562b
@ -1,2 +1,11 @@
|
|||||||
def rgb(r, g, b):
|
def rgb(r, g, b):
|
||||||
pass
|
rgb = {"r": int(r), "g": int(g), "b": int(b)}
|
||||||
|
|
||||||
|
for decimal in rgb:
|
||||||
|
rgb[decimal] = min(255, max(rgb[decimal], 0))
|
||||||
|
rgb[decimal] = hex(rgb[decimal]).split("x")[-1]
|
||||||
|
|
||||||
|
if len(rgb[decimal]) == 1:
|
||||||
|
rgb[decimal] = "0" + rgb[decimal]
|
||||||
|
|
||||||
|
return f"{rgb['r']}{rgb['g']}{rgb['b']}".upper()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user