TruWorlds

Color3

Represents a color in RGB space.

Fields

RByte byte

The red component of the color.

GByte byte

The green component of the color.

BByte byte

The blue component of the color.

Properties

R float

The red component of the color, in the range [0.0, 1.0].

G float

The green component of the color, in the range [0.0, 1.0].

B float

The blue component of the color, in the range [0.0, 1.0].

Functions

ToRgb32() Returns uint

Converts the color to a 32-bit unsigned integer in RGB format.

Returns: The color as a 32-bit unsigned integer in RGB format.

FromHsv(hue: float, saturation: float, value: float) Returns Color3

Creates a Color from HSV (Hue, Saturation, Value) components.

hue
The hue component, in the range [0.0, 1.0].
saturation
The saturation component, in the range [0.0, 1.0].
value
The value component, in the range [0.0, 1.0].

Returns: >The resulting Color.

NewRandom() Returns Color3

Generates a random opaque color.

Returns: >A random Color.

ToHex() Returns string

Converts the color to a hexadecimal (HTML) string representation.

Returns: The hexadecimal string representation of the color, in the format RRGGBB.

SetHex(hex: string) Returns Color3

Sets this color's components from a hexadecimal string (with or without a leading #).

hex
A 6-character RRGGBB hex string.

Returns: This color, with components updated to match .

FromHex(hex: string) Returns Color3

Creates a Color from a hexadecimal string (with or without a leading #).

hex
A 6-character RRGGBB hex string.

Returns: The resulting Color.

SetHsv(hue: float, saturation: float, value: float) Returns Color3

Sets this color from HSV (Hue, Saturation, Value) components.

hue
The hue component, in the range [0.0, 1.0].
saturation
The saturation component, in the range [0.0, 1.0].
value
The value component, in the range [0.0, 1.0].

Returns: This color, with components updated to match the HSV input.

Random() Returns Color3

Randomizes this color's RGB components.

Returns: This color, with randomized components.