Turtle Colors and RGB App
Posted by Al Sweigart in misc
I've been working on turtle-related projects and I needed a simple, interactive, single-file Python program to explain RGB color values. I wrote this one up as part of my work writing a Simple Turtle Tutorial written in Wikipedia-style Simple English so it can be translated to non-English languages. You can download the app from PyPI and look at its code on its git repo
The app has three sliders for the amount of red, blue, and green for the window's background color. The RGB values are presented under the sliders for the 0.0 to 1.0 scale, 0 to 255 scale, and hexadecimal 0x00 to 0xFF scale. You can drag the sliders or click on the slider lines directly. There are also 14 preset color buttons along the top to click on.
This is written as a single-file Python program using only the standard library. Unlike similar web apps, it's simple and doesn't have ads. If you have Python installed, you can run this program and learn about RGB values.
Install with python -m pip install turtlecolors
on Windows or python3 -m pip install turtlecolors
on macOS/Linux.
Run with python -m turtlecolors
on Windows or python3 -m turtlecolors
on macOS/Linux. Or run the code import turtlecolors;turtlecolors.main()
When the program first runs, it also prints out the color name strings that Python's turtle module uses. I've also compiled a complete list of valid and tested Python tkinter color names.