DPanel/SetBackgroundColor

From Garry's Mod
Jump to: navigation, search
 DPanel:SetBackgroundColor( )

Contents

DescriptionPanelFunc

Sets the background color of the panel.

Arguments

table color

The background color.

Examples

Example

Creates two empty panels with their background colors set to red and blue team colors.

COLOR_TEAM_RED = Color(255, 64, 64, 255)
COLOR_TEAM_BLUE = Color(153, 204, 255, 255)

BGPanel1 = vgui.Create("DPanel")
BGPanel1:SetPos(20, 20)
BGPanel1:SetSize(200, 200)
BGPanel1:SetBackgroundColor(COLOR_TEAM_RED)
		
BGPanel2 = vgui.Create("DPanel")
BGPanel2:SetPos(220, 20)
BGPanel2:SetSize(200, 200)
BGPanel2:SetBackgroundColor(COLOR_TEAM_BLUE)

Output:



DPanel SetBackgroundColor example1.png
Personal tools
Navigation