Friday, February 6, 2026
HomeLanguagesturtle.color() method in Python

turtle.color() method in Python

The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support.

turtle.color()

This method is used to change the color of the turtle. The default color is black.

Syntax:

turtle.color(*args)

Parameters:

Format  Arguments  Description
 turtle.color( colorstring )  colorstring  A string of color name like “red”, “green”, etc.
 turtle.color( (r, g, b) )   (r, g, b)  A tuple of three values r, g, and b using rgb color code
 turtle.color( r, g, b )  r, g, b  Three values r, g, and b using rgb color code

Below is the implementation of the above method with some examples :

Example 1 :

Python3




# importing package
import turtle
 
 
# use forward by 50 (default = black)
turtle.forward(50)
 
# change the color of turtle
turtle.color("red")
 
# use forward by 50 (color = red)
turtle.forward(50)


 
 

Output :

 

 

Example 2:

 

Python3




# importing package
import turtle
 
 
# use forward by 100 (default = black)
turtle.forward(100)
 
# change the color of turtle
turtle.color("red")
 
# use forward by 100 in 90 degrees
# right (color = red)
turtle.right(90)
turtle.forward(100)
 
# change the color of turtle
turtle.color((41,41,253))
 
# use forward by 100 in 90 degrees
# right (color = blue)
turtle.right(90)
turtle.forward(100)
 
# change the color of turtle
turtle.color(41,253,41)
 
# use forward by 100 in 90 degrees
# right (color = green)
turtle.right(90)
turtle.forward(100)


 
 

Output :

 

 

RELATED ARTICLES

Most Popular

Dominic
32489 POSTS0 COMMENTS
Milvus
126 POSTS0 COMMENTS
Nango Kala
6862 POSTS0 COMMENTS
Nicole Veronica
11983 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12073 POSTS0 COMMENTS
Shaida Kate Naidoo
6995 POSTS0 COMMENTS
Ted Musemwa
7236 POSTS0 COMMENTS
Thapelo Manthata
6946 POSTS0 COMMENTS
Umr Jansen
6930 POSTS0 COMMENTS