Friday, July 3, 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

2 COMMENTS

Most Popular

Dominic
32519 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6900 POSTS0 COMMENTS
Nicole Veronica
12015 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12110 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6966 POSTS0 COMMENTS