Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Named colors in tkinter

How can I get a list of all named colors in tkinter? I need to choose colors randomly and print their names to the user.

I found a list of all colors here: Colour chart for Tkinter and Tix Using Python I would rather get the list from the library than to hardcode it in my program.

like image 602
kinnla Avatar asked Oct 16 '25 16:10

kinnla


1 Answers

In case of linux (debian) there is a file /etc/X11/rgb.txt that has lines like

255 250 250             snow

and should be easy to parse. Your program could read color definitions from that file (or a copy of it) to a list, and then select a random color from that list.

like image 90
J.J. Hakala Avatar answered Oct 18 '25 08:10

J.J. Hakala



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!