I was working on a Python project where I needed to create colorful graphics using the Turtle module. The issue is, many beginners struggle with understanding all the different ways to add and manipulate colors in Turtle.
In this article, I’ll cover several simple methods to use colors effectively in your Python Turtle graphics (from basic color names to RGB values and more). So let’s get in!
Understand Turtle Colors Basics
The simplest way to add color to your Turtle graphics is by using the built-in color names that Python recognizes. This method is perfect for beginners or when you need quick, recognizable colors.
Here’s how you can use named colors in your Turtle graphics:
import turtle
t = turtle.Turtle()
t.speed(0) # Fastest speed
# Using basic color names
t.color("red")
t.begin_fill()
t.circle(50)
t.end_fill()
# Move to a new position
t.penup()
t.goto(100, 0)
t.pendown()
# Try another color
t.color("blue")
t.begin_fill()
t.circle(50)
t.end_fill()I executed the above example code and added the screenshot below.

In this example, I’ve created two filled circles – one red and one blue. Python Turtle recognizes many standard color names like “red”, “blue”, “green”, “yellow”, “purple”, etc.
What’s great about this method is its simplicity. You don’t need to remember complex color codes – just use the color name as a string.
Use Named Colors in Turtle
Here are some of the most commonly used color names in Turtle:
- red, green, blue
- yellow, orange, purple
- pink, violet, magenta
- cyan, turquoise
- black, white, gray/grey
- brown, beige, tan
To change just the outline color while keeping the fill color different, you can use:
t.pencolor("black") # Sets just the outline color
t.fillcolor("yellow") # Sets just the fill color
t.begin_fill()
t.circle(50)
t.end_fill()While named colors are convenient, they offer limited options. For more precise control, RGB color values are your best friend.
Check out Fractal Python Turtle
Work with RGB Color Values
RGB (Red, Green, Blue) values let you create any color by specifying the intensity of each primary color on a scale from 0 to 1:
import turtle
t = turtle.Turtle()
t.speed(0)
# Using RGB values (values must be between 0 and 1)
t.color((0.2, 0.8, 0.55)) # Create a custom green-blue
t.begin_fill()
t.circle(50)
t.end_fill()
# Move to new position
t.penup()
t.goto(100, 0)
t.pendown()
# Different outline and fill colors using RGB
t.pencolor((0.9, 0.1, 0.1)) # Reddish outline
t.fillcolor((1, 0.8, 0)) # Golden yellow fill
t.begin_fill()
t.circle(50)
t.end_fill()I executed the above example code and added the screenshot below.

What I love about using RGB values is the precision it offer. Want a specific shade of blue that’s not too dark but not too light? RGB lets you dial in exactly what you need.
One thing to remember is that Turtle’s RGB values range from 0 to 1 (not 0 to 255 like in many other systems). So 0.5 means 50% intensity of that color.
Use Hexadecimal Color Codes
For those familiar with web development, Turtle also supports hexadecimal color codes. These work just like in CSS or HTML:
import turtle
t = turtle.Turtle()
t.speed(0)
# Using hexadecimal color codes
t.color("#FF5733") # A bright orange
t.begin_fill()
t.circle(50)
t.end_fill()
# Move to new position
t.penup()
t.goto(100, 0)
t.pendown()
# Another hex color
t.color("#3498DB") # A nice blue
t.begin_fill()
t.circle(50)
t.end_fill()Hex codes give you the same precision as RGB values but in a format that’s compatible with web colors. This is particularly useful if you’re trying to match colors from a website or design.
Read Python Turtle Get Position
Create Color Gradients with Turtle
One of the most impressive ways to use color in Turtle is by creating gradients or color transitions. This requires a bit more code but produces beautiful results:
import turtle
import math
t = turtle.Turtle()
t.speed(0)
turtle.colormode(255) # Use 0-255 RGB values for easier transitions
# Create a color spiral with gradual change
for i in range(360):
# Calculate RGB values that change with each step
r = int(255 * math.sin(math.radians(i)) ** 2)
g = int(255 * math.sin(math.radians(i + 120)) ** 2)
b = int(255 * math.sin(math.radians(i + 240)) ** 2)
t.pencolor(r, g, b)
t.width(i/100 + 1)
t.forward(i/4)
t.left(15)
turtle.done()I executed the above example code and added the screenshot below.

In this example, I’ve created a spiral where the color gradually shifts through a rainbow pattern. The colormode(255) function lets us use the more common 0-255 range for RGB values instead of 0-1.
I’ve found gradients particularly useful for creating more professional-looking visualizations and art pieces. They add a level of polish that solid colors can’t match.
Check out Make a Smiling Face in Python Turtle
Set Background Colors
Don’t forget that you can also set the background color of your entire Turtle screen:
import turtle
# Create screen and set background color
screen = turtle.Screen()
screen.bgcolor("lightblue") # Using a named color
# Or with RGB
# screen.bgcolor((0.8, 0.8, 1.0)) # Light blue using RGB
t = turtle.Turtle()
t.color("navy")
t.begin_fill()
t.circle(50)
t.end_fill()
turtle.done()I executed the above example code and added the screenshot below.

Changing the background color can dramatically affect how your foreground elements look. I often use this to create better contrast or to set the mood of the entire graphic.
Read Python Turtle Nested Loop
Color-Based Visualization Example
Let’s create a practical example – a simple temperature visualization for US cities using colors:
import turtle
# Sample data: City names and temperatures (°F)
cities = [
("New York", 45),
("Los Angeles", 75),
("Chicago", 32),
("Miami", 82),
("Denver", 28)
]
# Setup
screen = turtle.Screen()
screen.title("US City Temperatures")
screen.bgcolor("white")
t = turtle.Turtle()
t.speed(0)
t.penup()
t.hideturtle()
# Function to convert temperature to color
def temp_to_color(temp):
# Cold: blue (30°F) to Hot: red (90°F)
if temp <= 32:
return "#0000FF" # Very cold - deep blue
elif temp <= 50:
return "#6666FF" # Cool - lighter blue
elif temp <= 70:
return "#FFFF00" # Moderate - yellow
elif temp <= 85:
return "#FF6600" # Warm - orange
else:
return "#FF0000" # Hot - red
# Draw temperature bars
y_pos = 200
for city, temp in cities:
# Position for this city
t.goto(-200, y_pos)
# Write city name
t.write(f"{city}: {temp}°F", font=("Arial", 12, "normal"))
# Draw temperature bar
t.goto(-50, y_pos)
t.pendown()
t.fillcolor(temp_to_color(temp))
t.begin_fill()
for _ in range(2):
t.forward(temp * 2) # Bar length based on temperature
t.left(90)
t.forward(20)
t.left(90)
t.end_fill()
t.penup()
# Move to next position
y_pos -= 50
turtle.done()This example creates a simple bar chart where each bar’s color represents the temperature in that city. Cold temperatures are blue, while hot temperatures are red, with a gradient in between.
This type of color-based visualization helps users quickly understand the data without having to read the specific numbers.
Tips for Using Colors Effectively in Turtle
After years of working with Turtle graphics, I’ve found these practices helpful:
- Use contrast wisely: Make sure your foreground and background colors have enough contrast to be visible.
- Limit your palette: Using too many colors can make your graphics look chaotic. Stick to 3-5 complementary colors for most projects.
- Consider colorblindness: About 8% of men have some form of color blindness. Avoid relying solely on red/green distinctions.
- Test your colors: Colors may look different on different monitors. Test your code on multiple devices if possible.
- Use colors semantically: In data visualizations, use colors that intuitively match what they represent (red for hot, blue for cold, etc.).
Python’s Turtle module gives us many ways to work with colors, from simple named colors to complex RGB gradients. Whether you’re creating educational graphics, data visualizations, or digital art, understanding how to manipulate color will take your Turtle projects to the next level.
I hope you found this article helpful. If you have any questions or suggestions, kindly leave them in the comments below.
Other Python articles you may also like:

I am Bijay Kumar, a Microsoft MVP in SharePoint. Apart from SharePoint, I started working on Python, Machine learning, and artificial intelligence for the last 5 years. During this time I got expertise in various Python libraries also like Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… for various clients in the United States, Canada, the United Kingdom, Australia, New Zealand, etc. Check out my profile.