📌  相关文章
📜  将十六进制 rgb 转换为 matplotlib 颜色 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:42.143000             🧑  作者: Mango

代码示例1
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)