Category:DColorPalette

From Garry's Mod
Jump to: navigation, search

Contents

DescriptionPanelPage

The DColorPalette allows the player to select a color from a list of given colors.

This panel supports saving across sessions via the panel cookie system.
Use Panel:SetCookieName to change "save files".

Inherited Functions

Inherits the following functions from DIconLayout and its parents up to 3 levels deep:


Examples

Example

Creates a DColorPalette in a DFrame, clicking on a color will change the DColorButton's color to the selected color

local Frame = vgui.Create( "DFrame" )
Frame:SetSize( 170, 200 )
Frame:Center()
Frame:MakePopup()

local DColorPalette = vgui.Create( "DColorPalette", Frame )
DColorPalette:SetPos( 5, 50 )
DColorPalette:SetSize( 160, 50 )

local DColorButton = vgui.Create( "DColorButton", Frame )
DColorButton:SetSize( 50, 50 )
DColorButton:SetPos( 60, 100 )

-- This function is assigned AFTER DColorButton is created so we can use the DColorButton
DColorPalette.OnValueChanged = function( s, value )
	DColorButton:SetColor( value )
end


Personal tools
Navigation