convert rgb to hex '#{:02x}{:02x}{:02x}'.format( 120, 0 , 255 ) '#7800ff' convert rgba (a=alpha) to hex
'#{:02x}{:02x}{:02x}{:02x}'.format( 120, 0 , 255, 128 ) '#7800ff80' convert numbers between 0 and 1 into hex color code
import matplotlib same, but with additional transparent (alpha) value '0.5'
c) using python package webcolorsrgb_to_hex((120, 0, 255)) u'#7800ff' read more |