Garry's Mod Wiki

DColorMixer

Description

A standard Derma color mixer

View source

Parent

Derives methods, etc not listed on this page from DPanel.

Implements

Implements or overrides the following hooks/methods. If you want to override these, you probably want to call the original function too.

Events

DColorMixer:ValueChanged( table col )
Called when the player changes the color of the DColorMixer. The returned color will not have the color metatable.

Methods

DColorMixer:ConVarThink()
This is used internally - although you're able to use it you probably shouldn't.
DColorMixer:DoConVarThink( string cvar )
This is used internally - although you're able to use it you probably shouldn't.
boolean DColorMixer:GetAlphaBar()
Return true if alpha bar is shown, false if not.
table DColorMixer:GetColor()
Returns the current selected color.
string DColorMixer:GetConVarA()
Returns the ConVar name for the alpha channel of the color. See also: DColorMixer:GetConVarR - For the red channel DColorMixer:GetConVarG - For the green channel DColorMixer:GetConVarB - For the blue channel
string DColorMixer:GetConVarB()
Returns the ConVar name for the blue channel of the color. See also: DColorMixer:GetConVarR - For the red channel DColorMixer:GetConVarG - For the green channel DColorMixer:GetConVarA - For the alpha channel
string DColorMixer:GetConVarG()
Returns the ConVar name for the green channel of the color. See also: DColorMixer:GetConVarR - For the red channel DColorMixer:GetConVarB - For the blue channel DColorMixer:GetConVarA - For the alpha channel
string DColorMixer:GetConVarR()
Returns the ConVar name for the red channel of the color. See also: DColorMixer:GetConVarG - For the green channel DColorMixer:GetConVarB - For the blue channel DColorMixer:GetConVarA - For the alpha channel
boolean DColorMixer:GetPalette()
Return true if palette is shown, false if not.
Vector DColorMixer:GetVector()
Returns the color as a normalized Vector.
boolean DColorMixer:GetWangs()
Return true if the wangs are shown, false if not.
DColorMixer:SetAlphaBar( boolean show )
Show/Hide the alpha bar in DColorMixer
DColorMixer:SetBaseColor( table clr )
Sets the base color of the DColorCube part of the DColorMixer. See also DColorCube:SetBaseRGB
DColorMixer:SetColor( table color )
Sets the color of the DColorMixer
DColorMixer:SetConVarA( string convar )
Sets the ConVar name for the alpha channel of the color. See also: DColorMixer:SetConVarR - For the red channel DColorMixer:SetConVarG - For the green channel DColorMixer:SetConVarB - For the blue channel
DColorMixer:SetConVarB( string convar )
Sets the ConVar name for the blue channel of the color. See also: DColorMixer:SetConVarR - For the red channel DColorMixer:SetConVarG - For the green channel DColorMixer:SetConVarA - For the alpha channel
DColorMixer:SetConVarG( string convar )
Sets the ConVar name for the green channel of the color. See also: DColorMixer:SetConVarR - For the red channel DColorMixer:SetConVarB - For the blue channel DColorMixer:SetConVarA - For the alpha channel
DColorMixer:SetConVarR( string convar )
Sets the ConVar name for the red channel of the color. See also: DColorMixer:SetConVarG - For the green channel DColorMixer:SetConVarB - For the blue channel DColorMixer:SetConVarA - For the alpha channel
DColorMixer:SetLabel( string text = "nil" )
Sets the label's text to show.
DColorMixer:SetPalette( boolean enabled )
Show or hide the palette panel
DColorMixer:SetVector( Vector vec )
Sets the color of DColorMixer from a Vector. Alpha is not included.
DColorMixer:SetWangs( boolean show )
Show / Hide the colors indicators in DColorMixer
DColorMixer:UpdateColor( table clr )
This is used internally - although you're able to use it you probably shouldn't. Use DColorMixer:SetColor instead!
DColorMixer:UpdateConVar( string cvar, string part, table clr )
This is used internally - although you're able to use it you probably shouldn't.
DColorMixer:UpdateConVars( table clr )
This is used internally - although you're able to use it you probably shouldn't.

Example

Creates a DColorMixer in a DFrame, as seen above

local Frame = vgui.Create("DFrame") Frame:SetSize(267,186) -- Good size for example Frame:Center() Frame:MakePopup() local Mixer = vgui.Create("DColorMixer", Frame) Mixer:Dock(FILL) -- Make Mixer fill place of Frame Mixer:SetPalette(true) -- Show/hide the palette DEF:true Mixer:SetAlphaBar(true) -- Show/hide the alpha bar DEF:true Mixer:SetWangs(true) -- Show/hide the R G B A indicators DEF:true Mixer:SetColor(Color(30,100,160)) -- Set the default color

Preview from the derma_controls concmd

DColorMixer.gif