Skip to content

Archmage.Rgba

Converts between Color, the type of an rgba field, and the format of the config files.

Inherits: RefCounted

In the config files, a color is "#RRGGBB" when it is opaque, "#RRGGBBAA" otherwise, and "" or null when every channel is 0. Color keeps each 8-bit channel exactly, so a color that is read and then written does not change.

static func from_json(v: Variant, e: Archmage.ParseError = null) -> Color

Returns the color in v, a parsed JSON value. For null and "", returns Color(0, 0, 0, 0). For any other value that is not "#RRGGBB" or "#RRGGBBAA", records the error in e (see Archmage.ParseError.report()) and returns Color(0, 0, 0, 0).

static func to_json(c: Color) -> String

Returns c in the format of the config files, with uppercase hex digits. Each channel is rounded to 8 bits.