Color( 0, 0, 0, 255 ) is invisible, not black.

So I’ve been trying to ignore this, but it’s becoming a problem. In my derma code, every time I place an element in and color it, the system is messed up. If I type “Color( 0, 0, 0, 255 )” on a derma button, it shows up invisible. If I type “Color( 120, 0, 0, 255 )” on a button, it shows up red but a lot brighter and paler than it should be.

I’m using draw.SimpleText(). This Color() function works perfectly on draw.RoundedBox(). Randomly in some other places it failed to work as well, and I’m a bit confused as to why. Any ideas?

EDIT: Just learned something. The Text is tied to a button in the Button.Paint() function. Beneath the text is a roundedbox. If the box’s color is brighter than the text’s color, then the text wont show at all. The text has to be brighter.
And when I make the text brighter, it seems to be relative to the box’s color. If the box’s color is 0,0,0,255 and the text’s color is 120,0,0,255 then it appears as a dark red. If the box is 120,0,0,255 and the text is 120,0,0,255, then the text appears to be 240,0,0,255 like it’s adding to the box’s RGB.

If I wanted to color a derma button, I’d do something like



local button = vgui.Create( "DButton" )
button.Paint = function( self, w, h )
   draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 255 ))
end
button:SetTextColor(Color( 255, 255, 255, 255 )


That seems to work fine for me…

I don’t know what method you’re using to color your buttons?

Is it possible to change the font of the default “DButton” text? That would work, yes, it’s what I used before, but it offers little customization to the text.

Here’s an example of what I’m doing:



local Button = vgui.Create( "DButton", Panel )
	Button:SetPos( ScrW()/30, ScrH()/6 )
	Button:SetSize( ScrW()/9.6, ScrH()/20 )
	Button:SetText( "" )
	Button.Paint = function()
		draw.RoundedBox( 8, 0, 0, Button:GetWide(), Button:GetTall(), Color( 255, 255, 255, 255 ) )
		draw.SimpleText( "TEXT HERE", "Trebuchet24", Button:GetWide()/2, Button:GetTall()/2, Color( 0, 0, 0, 255 ), 1, 1  )
	end


Pretty sure its button:SetFont().
Use the wiki to find out functions.

sounds like your font is additive

Okay, in the wiki it has “SetFont” under the DLabel functions but not the DButton. I tried it anyways and it works. The text on a button is actually a DLabel and everything that works for a DLabel will work for the DButton text as well. Thank you for your help.