Garry's Mod Wiki

DPanel:SetBackgroundColor

  DPanel:SetBackgroundColor( table color )

Description

Sets the background color of the panel.

Arguments

1 table color
The background color.

Example

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

local COLOR_TEAM_RED = Color(255, 64, 64, 255) local 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: