← Back to 2D Structs

Color

⚠️ Experimental - Pre-Release

Color represents a color with RGBA components. Used for coloring shapes, sprites, lights, and other visual elements.

Fields

r: float

The red component (0.0 to 1.0).

g: float

The green component (0.0 to 1.0).

b: float

The blue component (0.0 to 1.0).

a: float

The alpha component (0.0 to 1.0).

Usage Example

@script MyShape extends Shape2D    fn init() {        // Create a red color        self.color = new Color(1.0, 0.0, 0.0, 1.0)         // Or create a semi-transparent blue        var blue = new Color(0.0, 0.0, 1.0, 0.5)        self.color = blue    }

Related