1hex_color = '3366CC'
2
3# from 0-255 integer format
4up_to_255_rgb = tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4))
5#output: (51, 102, 204)
6
7# from 0-1 float format
8up_to_1_rgb = tuple(int(hex_color[i:i+2], 16)/255 for i in (0, 2, 4))
9#output: (0.2, 0.4, 0.8)