← Back to Blog

"Turtle Color Python: How to Change Pen and Background Colors

"2026-11-10

When you are learning turtle color python, you quickly realize that colors are what bring your code to life. A simple square becomes a neon sign. A circle becomes a glowing planet. The turtle module gives you complete control over colors.

In this guide, we will look at how to use named colors, how to set the background color, and how to use RGB values for precise control.

Using Named Colors

The easiest way to change the color is to use a named color. Python Turtle supports hundreds of standard colors like "red", "blue", "green", "cyan", "magenta", "gold", and "hotpink".

You can change the pen color using color() and the background using bgcolor().

Python
from turtle import * bgcolor("black") color("hotpink") pensize(5) forward(100) right(90) color("cyan") forward(100) right(90) color("gold") forward(100) done()

Using RGB Colors

For precise control, you can use RGB values. You need to set colormode(255) first. Then you can pass three numbers (Red, Green, Blue) between 0 and 255.

Python
from turtle import * bgcolor("black") colormode(255) pensize(6) color(255, 100, 50) forward(100) right(90) color(50, 200, 255) forward(100) done()

See What You Can Build

Once you master turtle color python, you can create stunning visual art. Check out this colorful Pinwheel Flower, which uses a list of colors and a loop to create a rainbow effect.

Pinwheel Flower using turtle color python commands

This design uses overlapping circles and a color palette to create a beautiful floral effect.

View the Full Code

Practice Using Colors

Want to learn how to use both named colors and RGB values? Start with our interactive lesson on named colors.

Take Python Everywhere

If you want to practice Python Turtle and master Python on your phone, we highly recommend Python Play. It features a built-in Turtle graphics playground and 100 interactive levels to test your coding skills.

Python Play: Coding & Quiz App

Learn Python, solve 100 challenges, and run real Turtle graphics code directly on your phone. No setup required.

Get it on Google Play