natiny.render.set_color
natiny.render.set_color(r, g, b, a)
Sets the draw color used to tint all subsequent non-clear draws until it is changed or another window is bound.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
r |
number |
1.0 |
Red channel (0.0 – 1.0) |
g |
number |
1.0 |
Green channel (0.0 – 1.0) |
b |
number |
1.0 |
Blue channel (0.0 – 1.0) |
a |
number |
1.0 |
Alpha channel (0.0 – 1.0) |
Example
natiny.render.set_color(1.0, 0.0, 0.0, 1.0)
Notes
- The color resets to opaque white
(1, 1, 1, 1)onnatiny.window.bind. - It affects all subsequent non-clear draws, including shapes, textures,
surfaces, text and models. It does not affect
natiny.render.clear. - A model has a tint of its own, set with natiny.model.set_color; the two multiply, so a bulk draw can still differ per model.
- Changing the color does not cause a batch break - different colors can coexist in the same draw batch for maximum performance.