Python from color name to RGB

前端 未结 2 1928
悲&欢浪女
悲&欢浪女 2021-01-17 14:28

If I have a function which takes color as an input to be edited first (by RGB numbers), and then used in matplotlib.pyplot. How can I

2条回答
  •  遥遥无期
    2021-01-17 15:00

    You can use with matplotlib.colors

    from matplotlib import colors
    
    print(colors.to_rgba('blue'))
    

    Result:

    (0.0, 0.0, 1.0, 1.0)
    

提交回复
热议问题