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:SetUnpacked( number r, number g, number b, number a )
Sets the red, green, blue, and alpha of the color.
number, number, number Color:ToHSL()
Converts a Color into HSL color space. This calls ColorToHSL internally.
number, number, number Color:ToHSV()
Converts a Color into HSV color space. This calls ColorToHSV internally.
table Color:ToTable()
Returns the color as a table with four elements.
Vector Color:ToVector()
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
number, number, number, number Color:Unpack()
Returns the red, green, blue, and alpha of the color.

Page Links


Special Pages


Wikis

?

Render Time: 70ms

DB GetPage 3
Generate Html 19
SaveChanges (1) 25
Render Body 0
Render Sidebar 20