📅  最后修改于: 2022-03-11 14:46:42.143000             🧑  作者: Mango
hex_color = '3366CC'
# from 0-255 integer format
up_to_255_rgb = tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4))
#output: (51, 102, 204)
# from 0-1 float format
up_to_1_rgb = tuple(int(hex_color[i:i+2], 16)/255 for i in (0, 2, 4))
#output: (0.2, 0.4, 0.8)