I need a mapping between every tkinter "color name" and "color value(in rgb e.g.)". It could be a one-by-one corresponding list or a function to convert those.
There are functions like matplotlib's hex2color or to_rgba but they don't support all tkinter color names as some of them are too special to the module(like "ghost white"); and I wonder of course there must be one specific to tkinter itself as its developers has needed that to implement the module.
Use the
winfo_rgb
method. If you pass it yellow, it will return the rgb value (16 bit) which you can then just divide by 256 to get the approx 8 bit value.returns (65535, 65535, 0)
returns (63736, 63736, 65535)
A oneliner to get the 8bit RGB values as a tuple is