Garry's Mod Wiki

Color

List of all possible functions to manipulate colors.

Colors are implemented in Lua thus type(color) == "table" and TypeID(color) == TYPE_TABLE.

For type checking use IsColor.

Created by Color, HSVToColor, and HSLToColor.

Type Name Description
number r The red component of the color.
number g The green component of the color.
number b The blue component of the color.
number a The alpha component of the color.

Methods

Color Color:Lerp( Color target, number fraction )
Performs linear interpolation between this and given colors.
Color:SetUnpacked( number r, number g, number b, number a )
Sets the red, green, blue, and alpha of the color.
Converts a Color into HSL color space. This calls ColorToHSL internally.
Encodes a RGB Color into the HSV color space. This function uses ColorToHSV internally.
table Color:ToTable()
Returns the color as a table with four elements.
Translates the Color into a Vector, losing the alpha channel. This will also range the values from 0 - 255 to 0 - 1 r / 255 -> x g / 255 -> y b / 255 -> z This is the opposite of Vector:ToColor
Returns the red, green, blue, and alpha of the color.