Derma Panel Color

Right now i’m new to coding in lua plus Glua and do you guys know any codes that change the color of the tab like where the name is and stuff if you know plz tell me :slight_smile:
plus if you know a color picker that would be useful, thanks!

Are you trying to change that little bit at the top of a DFrame? Where it has the title and all that?

details, details, details


I’ve seen this done before myself. I don’t really know how to do this particularly though.

This may help you

I use this
function DermaPanel:Paint()
– Derma_DrawBackgroundBlur(self)

local CenterY = ScrH() / 2
local CenterX = ScrW() / 2

– surface.SetDrawColor(10, 21, 100, 255)
surface.DrawRect(0, 0, ScrW(), ScrH())
– surface.SetDrawColor(10, 21, 100, 255)
surface.DrawOutlinedRect( 0, 0, 700, 860 )

//fancy paint shit
surface.SetDrawColor( 0, 0, 0, 200 )

surface.DrawRect( 0, 0, DermaPanel:GetWide(), DermaPanel:GetTall() )
surface.SetDrawColor( 10, 21, 100, 255 )

draw.RoundedBox( 0, 0, 0, self:GetWide(), 23, Color(0, 126, 199, 255) )

While that works fine for modiying DPanel, the OP wants to change the title bar of a DFrame, which involves changing the skin function so that the buttons still paint correctly.

Also you have 700,860 hard coded in there… And does this [lua]surface.DrawRect( 0, 0, DermaPanel:GetWide(), DermaPanel:GetTall() )[/lua]even work? You should be using self instead of DermaPanel there.

On my code,
draw.RoundedBox( 0, 0, 0, self:GetWide(), 23, Color(0, 126, 199, 255) )
Is the title.

As a side note, PANEL:Paint( w, h ) gives both the width and height parameters of the panel – there is no need to call self:GetWide() and self:GetTall(). An example:

local BLACK = Color( 0, 0, 0 )

function somePanel:Paint( w, h )
    draw.RoundedBox( 0, 0, 0, w, h, BLACK )

I thought it returned 3, an object, then the width and the height.

Perhaps you are not seeing the use of “:” as opposed to “.” in this context.


function PANEL:Paint( w, h ) end

“self” is implicitly passed.

However, with

function PANEL.Paint( self, w, h ) end


PANEL.Paint = function( self, w, h ) end

“self” must be explicitly passed.

I hope this clears up any confusion.