python rgb values to hex code ? code example
Example 1: hex to rgb python
from colormap import rgb2hex
from colormap import hex2rgb
print(rgb2hex(255, 255, 255))
print(hex2rgb('#FFFFFF'))
>>> #FFFFFF
>>> (255, 255, 255)
Example 2: hex to rgb python
h = input('Enter hex: ').lstrip('#')
print('RGB =', tuple(int(h[i:i+2], 16) for i in (0, 2, 4)))