Skip to content

Data type

BrickColor

Official docs ↗

A data type that provides a predefined list of named colors.

About BrickColor

The BrickColor data type provides a predefined list of named colors, not to be confused with Color3, a more general data type that describes RGB colors. The following code shows how to use BrickColor.new to declare the BrickColor property of a Part.

local part = Instance.new("Part")

-- By color name
part.BrickColor = BrickColor.new("Pastel Blue")
print(part.BrickColor) --> Pastel Blue

-- By numerical index
part.BrickColor = BrickColor.new(11)
print(part.BrickColor) --> Pastel Blue

-- By RGB decimal values in range of 0-1
part.BrickColor = BrickColor.new(0.502, 0.734, 0.859)
print(part.BrickColor) --> Pastel Blue

-- By palette index
part.BrickColor = BrickColor.palette(70)
print(part.BrickColor) --> Gold

The following table is the list of available brick colors.

Constructors 14

  • BrickColor.new(val: number)Constructs a BrickColor from its numerical index.
  • BrickColor.new(r: number, g: number, b: number)Constructs the closest BrickColor that can be matched to the specified RGB components.
  • BrickColor.new(name: string)Constructs a BrickColor from its name.
  • BrickColor.new(color: Color3)Constructs the closest BrickColor that can be matched to the specified Color3.
  • BrickColor.palette(paletteValue: number)Constructs a BrickColor from its palette index.
  • BrickColor.random()Returns a random BrickColor.
  • BrickColor.White()Returns the "White" BrickColor.
  • BrickColor.Gray()Returns the "Medium stone grey" BrickColor.
  • BrickColor.DarkGray()Returns the "Dark stone grey" BrickColor.
  • BrickColor.Black()Returns the "Black" BrickColor.
  • BrickColor.Red()Returns the "Bright red" BrickColor.
  • BrickColor.Yellow()Returns the "Bright yellow" BrickColor.
  • BrickColor.Green()Returns the "Dark green" BrickColor.
  • BrickColor.Blue()Returns the "Bright blue" BrickColor.

Properties 6

  • Number: numberThe unique number that identifies the BrickColor.

    The unique number that identifies the BrickColor. This is the same integer used by BrickColor.new to construct the color and corresponds to the Number column in the color table above. Read-only.

  • r: numberThe red component of the BrickColor (between 0 and 1).

    The red component of the BrickColor (between 0 and 1). This is equivalent to BrickColor.Color.R. Read-only.

  • g: numberThe green component of the BrickColor (between 0 and 1).

    The green component of the BrickColor (between 0 and 1). This is equivalent to BrickColor.Color.G. Read-only.

  • b: numberThe blue component of the BrickColor (between 0 and 1).

    The blue component of the BrickColor (between 0 and 1). This is equivalent to BrickColor.Color.B. Read-only.

  • Name: stringThe name associated with the BrickColor.

    The name associated with the BrickColor, for example "Pastel Blue". This is the same string accepted by BrickColor.new. Read-only.

  • Color: Color3The Color3 associated with the BrickColor.

    The Color3 associated with the BrickColor. The individual components of this value are the same as BrickColor.r, BrickColor.g, and BrickColor.b. Read-only.

Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.