Garry's Mod Wiki


  table IMaterial:GetColor( number x, number y )


Returns the color of the specified pixel of the $basetexture, only works for materials created from PNG files.

Basically identical to ITexture:GetColor used on IMaterial:GetTexture( "$basetexture" ).

The returned color will not have the color metatable.

Issue Tracker: 2407


1 number x
The X coordinate.
2 number y
The Y coordinate.


1 table
The color of the pixel as a Color.


Identical functionality.

local m = Material( "gui/colors_dark.png" ) local t = m:GetTexture("$basetexture") PrintTable( t:GetColor( 5, 5 ) ) PrintTable( m:GetColor( 5, 5 ) )
Output: Both printouts will return identical color, which at the time of testing is RGBA - 255, 244, 242, 255.