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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With