color(r: number , g: number , b: number ): ColorComp
Sets the color of a Game Object (rgb 0-255).
paramr- The red value to set.
paramg- The green value to set.
paramb- The blue value to set.
// blue frog
add([
sprite("bean"),
color(0, 0, 255),
]);
returnsThe color comp.
sincev2000.0
groupComponents
subgroupRendering
color(c: Color ): ColorComp
Sets the color of a Game Object using a previously created Color Object.
paramc- The color to clone and set.
// blue frog
const blue = rgb(0, 0, 255);
add([
sprite("bean"),
color(blue),
]);
returnsThe color comp.
sincev2000.0
groupComponents
subgroupRendering
color(rgb:
[
number, number, number
]
): ColorComp
Sets the color of a Game Object using an array (rgb 0-255).
paramrgb- The color array to set [r, g, b].
// blue frog
add([
sprite("bean"),
color([0, 0, 255]),
]);
returnsThe color comp.
sincev2000.0
groupComponents
subgroupRendering
color(c: OptionalString ): ColorComp
Sets the color of a Game Object using a CSS color keywords or hexadecimal string.
paramc- The CSS color keyword or hexadecimal code to set.
// blue frog (HEX)
add([
sprite("bean"),
color("#0000ff"),
]);
// red cheese (CSS)
add([
sprite("mark"),
color("red"),
]);
returnsThe color comp.
sincev2000.0
groupComponents
subgroupRendering
color(c: number ): ColorComp
Sets the color of a Game Object using a hexadecimal literal number.
paramc- The hexadecimal literal number.
// blue frog
add([
sprite("bean"),
color(0x0000ff),
]);
returnsThe color comp.
sincev2000.0
groupComponents
subgroupRendering
color(): ColorComp
Sets the color of a Game Object to white (no effect).
// normal frog
add([
sprite("bean"),
color(),
]);
returnsThe color comp.
sincev2000.0
groupComponents
subgroupRendering