An 8-bit RGBA colour.

Nearly every drawing native in FiveM (DRAW_MARKER, SET_TEXT_COLOUR, DRAW_RECT, ...) takes four separate red, green, blue, alpha integers. Passing a Rgba around instead of four loose numbers removes an entire category of argument-order mistakes; unpack it at the call site with c.r, c.g, c.b, c.a.

Static methods

@:value({ alpha : 255 })staticinlineblack(alpha:Int = 255):Rgba

@:value({ alpha : 255 })staticinlineblue(alpha:Int = 255):Rgba

staticinlinecopy(this:RgbaData):Rgba

@:op(A == B)staticinlineequals(this:RgbaData, rhs:Rgba):Bool

@:value({ alpha : 255 })staticfromHex(hex:String, alpha:Int = 255):Rgba

Parses "#RRGGBB" or "#RRGGBBAA" (the leading # is optional).

@:value({ alpha : 255 })staticinlinegreen(alpha:Int = 255):Rgba

staticinlinelerp(this:RgbaData, target:Rgba, t:Float):Rgba

Blends towards target; t of 0 keeps this colour, 1 gives target.

@:op(A != B)staticinlinenotEquals(this:RgbaData, rhs:Rgba):Bool

@:value({ alpha : 255 })staticinlinered(alpha:Int = 255):Rgba

staticinlinetoHex(this:RgbaData):String

staticinlinetoInt(this:RgbaData):Int

Packs into a single 0xRRGGBBAA integer.

Built with multiplication instead of shifts for the reason described in fromHex — the components are non-overlapping bytes, so the result is identical.

staticinlinetoString(this:RgbaData):String

@:value({ alpha : 255 })staticinlinewhite(alpha:Int = 255):Rgba

staticinlinewithAlpha(this:RgbaData, alpha:Int):Rgba

A copy with a different alpha, leaving the hue untouched.

@:value({ alpha : 255 })staticinlineyellow(alpha:Int = 255):Rgba