Want a special badge and 30 bux? Make some PolyWorld! Content and post it in the Creations forum!
Dark mode is incomplete! Please report any issues to the Discord.

Color

LocalScripts Scripts

Color stores an RGB triple.
On Parts and similar properties, channels are 0 to 1.
Constructors that take 0 to 255 convert and store 0 to 1.

The constructor library is still named RGBColor for compatibility. Prefer Color going forward where available.


Overview

Properties

  • .R : number
  • .r deprecated : number
  • .G : number
  • .g deprecated : number
  • .B : number
  • .b deprecated : number

Methods


API

Properties

R

R : number
Red channel (0 to 1 when read from a Part).

r

r deprecated : number
Identical to R.
No longer recommended for use.

G

G : number
Green channel (0 to 1 when read from a Part).

g

g deprecated : number
Identical to G.
No longer recommended for use.

B

B : number
Blue channel (0 to 1 when read from a Part).

b

b deprecated : number
Identical to B.
No longer recommended for use.

Methods

new

new(r: number, g: number, b: number) : Color
Creates a Color from 0 to 255 channels (stored as 0 to 1).

part.Color = Color.new(255, 0, 0)

RGBColor.new

RGBColor.new(r: number, g: number, b: number) : Color deprecated
Identical to new.
Kept as the current global constructor name.
No longer recommended for use once Color.new is available.

random

random() : Color
Creates a random Color.

RGBColor.random

RGBColor.random() : Color deprecated
Identical to random.
No longer recommended for use once Color.random is available.