Garry's Mod Wiki

Revision Difference

DPanel:SetBackgroundColor#515329

<function name="SetBackgroundColor" parent="DPanel" type="panelfunc">⤶ <ispanel>yes</ispanel>⤶ <description>Sets the background color of the panel.</description>⤶ <realm>Client</realm>⤶ <args>⤶ <arg name="color" type="table">The background color.</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>Creates two empty panels with their background colors set to red and blue team colors.</description>⤶ <code>⤶ 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)⤶ </code>⤶ <output></output>⤶ ⤶ </example>