How can I randomly generate color on the GDS?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Korsut

How can I randomly generate color on the GDS?

:bust_in_silhouette: Reply From: kidscancode

By “the GDS” I’m assuming you mean GDScript?

The Color object is documented here:

randf() generates a random number between 0 and 1:

So to get a random color

var random_color = Color(randf(), randf(), randf())

Note that if you need a “pleasant”-looking color, you need to use a more complex algorithm. See this Stack Overflow question for some examples.

Calinou | 2020-04-22 14:53