如何从python中的十六进制颜色代码获取彩色像素?

时间:2017-09-06 20:50:58

标签: python

这是我将文本转换为彩色像素的代码,但它只打印特定颜色的点。

from colored import fg, bg, attr
d={}
d["a"]="#800000"
d["b"]="#c0c0c0"
d["c"]="#ffff00" 
d["d"]="#000080"
d["e"]="#ffffff"
d["f"]="#ff00ff"
d["g"]="#808080"
d["h"]="#008080"
d["i"]="#005f00"
d["j"]="#00afff"
d["k"]="#00ffff"
d["l"]="#5f0000" 
d["m"]="#5f5f5f"
d["n"]="#5f5fd7"
d["o"]="#5f8700"
d["p"]="#5fff5f"
d["q"]="#870087"
d["r"]="#875faf"
d["s"]="#878787"
d["t"]="#af00af"
d["u"]="#af5f87"
d["v"]="#afff00"
d["w"]="#d75fff"
d["x"]="#d787d7"
d["y"]="#d7afff"
d["z"]="#ffd700"
for key in d:
    color = fg(d[key])
    res = attr('reset')
    print (color + "." + res)

以上程序打印特定颜色的点。我想打印一种特定颜色的pixel

0 个答案:

没有答案