Data type
BrickColor
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 aBrickColorfrom its numerical index.BrickColor.new
(r: number, g: number, b: number)Constructs the closestBrickColorthat can be matched to the specified RGB components.BrickColor.new
(name: string)Constructs aBrickColorfrom its name.BrickColor.new
(color: Color3)Constructs the closestBrickColorthat can be matched to the specifiedColor3.BrickColor.palette
(paletteValue: number)Constructs aBrickColorfrom its palette index.BrickColor.random
()Returns a randomBrickColor.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 theBrickColor.The unique number that identifies the
BrickColor. This is the same integer used byBrickColor.newto construct the color and corresponds to the Number column in the color table above. Read-only.r
: numberThe red component of theBrickColor(between 0 and 1).The red component of the
BrickColor(between0and1). This is equivalent toBrickColor.Color.R. Read-only.g
: numberThe green component of theBrickColor(between 0 and 1).The green component of the
BrickColor(between0and1). This is equivalent toBrickColor.Color.G. Read-only.b
: numberThe blue component of theBrickColor(between 0 and 1).The blue component of the
BrickColor(between0and1). This is equivalent toBrickColor.Color.B. Read-only.Name
: stringThe name associated with theBrickColor.The name associated with the
BrickColor, for example"Pastel Blue". This is the same string accepted byBrickColor.new. Read-only.Color
: Color3TheColor3associated with theBrickColor.The
Color3associated with theBrickColor. The individual components of this value are the same asBrickColor.r,BrickColor.g, andBrickColor.b. Read-only.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.