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( Color col )
Called when the player changes the color of the DColorMixer. Meant to be overridden. The returned color will not have the color metatable.

Methods

DColorMixer:ConVarThink()
Internal: This is used internally - although you're able to use it you probably shouldn't.
DColorMixer:DoConVarThink( string cvar )
Internal: This is used internally - although you're able to use it you probably shouldn't.
boolean DColorMixer:GetAlphaBar()
An AccessorFunc that returns true if alpha bar is shown, false if not.
Color DColorMixer:GetColor()
An AccessorFunc that returns the current selected color.
string DColorMixer:GetConVarA()
An AccessorFunc that 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()
An AccessorFunc that 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()
An AccessorFunc that 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()
An AccessorFunc that 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()
An AccessorFunc that returns true if palette is shown, false if not.
Vector DColorMixer:GetVector()
Returns the color as a normalized Vector.
boolean DColorMixer:GetWangs()
An AccessorFunc that returns true if the wangs are shown, false if not.
DColorMixer:SetAlphaBar( boolean show )
An AccessorFunc that show/hide the alpha bar in DColorMixer
DColorMixer:SetBaseColor( Color clr )
Sets the base color of the DColorCube part of the DColorMixer. See also DColorCube:SetBaseRGB
DColorMixer:SetColor( Color color )
An AccessorFunc that sets the color of the DColorMixer. See also DColorMixer:GetColor
DColorMixer:SetConVarA( string convar )
An AccessorFunc that 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 )
An AccessorFunc that 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 )
An AccessorFunc that 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 )
An AccessorFunc that 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:SetPaletteName( string name )
Sets the palette name for this color mixer, making changes to the palette by the player after this function call be saved separately from other palettes. Naturally palettes with the same name will share the changes.
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( Color clr )
Internal: 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, Color clr )
Internal: This is used internally - although you're able to use it you probably shouldn't.
DColorMixer:UpdateConVars( Color clr )
Internal: This is used internally - although you're able to use it you probably shouldn't.
DColorMixer:UpdateDefaultColor()
sets the default color of the element to the currently selected color

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