Menu
CoddyTech

Change a Color

Part of the Nodes and Scenes section of Coddy's Godot journey. Lesson 22 of 27.

Every node that draws has a modulate, a color that tints it. A Color is red, green and blue, each from 0 to 1. modulate starts as white, Color(1, 1, 1), which changes nothing.

The tint multiplies the node's own colors. On something white, you see the tint color. On something blue, a coral tint makes purple.

$Body.modulate = Color(1, 0.78, 0.34)   # an amber tint

modulate also tints the node's children. Tint Eyes and both eyes change. To tint a node but not its children, use self_modulate.

challenge icon

Challenge

Easy

The robot's eyes are plain white. When the game starts, tint the Eyes node coral, Color(1, 0.42, 0.42), so both eyes glow coral. The body stays blue.

Try it yourself

extends Node2D

@onready var eyes = $Face/Eyes

func _ready():
	pass
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Nodes and Scenes

Practice on your own: Godot playground