color Module

Predefined Colors

The color module provides two sets of predefined color constants: color constants by color, and color constants by purpose.

The predefined color constants by color (represented here as HTML color codes) are as follows:

Constant

Color

color.WHITE

#FFFFFF

color.BLACK

#000000

color.RED

#FF0000

color.GREEN

#00FF00

color.BLUE

#0000FF

The predefined color constants by purpose are as follows:

Constant

Color

Purpose

color.MOTD

#FFFFFF

Welcome messages displayed to player at login.

color.ALERT

#D20000

Alerts and error messages displayed in chat.

color.CHAT_LOCAL

#B3B3B3

Local chat messages.

color.CHAT_GLOBAL

#FFFFFF

Global chat messages.

color.CHAT_SYSTEM

#808080

System chat messages.

Color Functions

Rgb(r, g, b)

Definition

color.Rgb(r, g, b)

Creates a color with the given red, green, and blue components. The alpha component is set to 255.

Parameters:
  • r (integer) – Red component.

  • g (integer) – Green component.

  • b (integer) – Blue component.

Returns:

Color.

Return type:

integer

Example

Using Rgb(r, g, b) to define a color.
local white = color.Rgb(255, 255, 255)

Rgba(r, g, b, a)

Definition

color.Rgba(r, g, b, a)

Creates a color with the given red, green, blue, and alpha components.

Parameters:
  • r (integer) – Red component.

  • g (integer) – Green component.

  • b (integer) – Blue component.

  • a (integer) – Alpha component.

Returns:

Color.

Return type:

integer

Example

Using Rgba(r, g, b, a) to define a color.
local transparentRed = color.Rgba(255, 0, 0, 160)