I work at a science center teaching kids science and coding.
We have been using Python Turtle to solve puzzels, drawing using rgb color code as a part of the solution.
But yesterday we noticed that rgb color does not work instead you have to use values between 0.0 and 1.0 instead of 1-255. t.pencolor(0.34,0.4,0.98) instead of t.pencolor(34,55,255)
I tried to google the issue and search this community but found nothing .
Is this a replit.com bug or have I missed some changes to Turtle?
After checking with an older template and getting the same issue I dug deeper. Turns out the colormode is important.
import turtle
t = turtle.Turtle()
screen = turtle.Screen()
print(screen.colormode()) # it will be 1.0 or 255
screen.colormode(255) # this sets it to use 0-255 for each r,g,b
t.pencolor(41,253,41)
t.pendown()
t.forward(50)
Hi @Epiphe I’m honestly not sure but remembered something about float values between 0.0 and 1.0 being a setting. Maybe the default template has changed but it’s hard to confirm. Glad it resolved the issue for you!