https://github.com/trflorian/godot-random-colors
Generate random colors from RGB and HSV color space
https://github.com/trflorian/godot-random-colors
chicken color gamedev godot
Last synced: 6 months ago
JSON representation
Generate random colors from RGB and HSV color space
- Host: GitHub
- URL: https://github.com/trflorian/godot-random-colors
- Owner: trflorian
- Created: 2024-10-27T11:07:27.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-27T11:13:36.000Z (over 1 year ago)
- Last Synced: 2025-07-01T15:12:44.095Z (about 1 year ago)
- Topics: chicken, color, gamedev, godot
- Language: GDScript
- Homepage: https://medium.com/@flip.flo.dev/better-random-colors-in-godot-9a656468f55e
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Random Colors in Godot
## Random Colors from RGB
A simple way to generate random colors in Godot is using random red, green and blue values.
```
func _generate_random_rgb_color() -> Color:
return Color(
randf(), # RED
randf(), # GREEN
randf(), # BLUE
)
```

## Random Colors from HSV
Using the HSV color space, you have more fine-grained control over the color. The hue, saturation and value can be controlled independently.
```
func _generate_random_hsv_color() -> Color:
return Color.from_hsv(
randf_range(0.25, 0.45), # HUE
randf_range(0.2, 0.6), # SATURATION
randf_range(0.9, 1.0), # BRIGHTNESS
)
```
