Garry's Mod Wiki

Revision Difference

DColorPalette#550036

<panel> <parent>DIconLayout</parent> <realm>Client and Menu</realm>⤶ <preview>DColorPalette.png</preview> <description> 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 <page>Panel:SetCookieName</page> to change "save files".⤶ 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 <page>Panel:SetCookieName</page> to change "save files". ⤶ </description> ⤶ </panel>⤶ <overrides>⤶ <page>Panel:Init</page>⤶ <page>Panel:PaintOver</page>⤶ <page>Panel:GenerateExample</page>⤶ </overrides>⤶ </panel>⤶ <example> <description>Creates a DColorPalette in a DFrame, clicking on a color will change the DColorButton's color to the selected color</description> <code> 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 </code> </example>