Garry's Mod Wiki

Revision Difference

IMaterial:GetColor#562072

<function name="GetColor" parent="IMaterial" type="classfunc"> <description> Returns the color of the specified pixel of the $basetexture, only works for materials created from PNG files. Basically identical to <page>ITexture:GetColor</page> used on <page>IMaterial:GetTexture</page>( "$basetexture" ). <bug issue="2407">The returned color will not have the color metatable.</bug> <bug issue="2407">The returned color will not have the color metatable. This will be fixed in the next update.</bug> </description> <realm>Shared and Menu</realm> <args> <arg name="x" type="number">The X coordinate.</arg> <arg name="y" type="number">The Y coordinate.</arg> </args> <rets> <ret name="" type="table">The color of the pixel as a <page>Color</page>.</ret> </rets> </function> <example> <description>Identical functionality.</description> <code> local m = Material( "gui/colors_dark.png" ) local t = m:GetTexture("$basetexture") PrintTable( t:GetColor( 5, 5 ) ) PrintTable( m:GetColor( 5, 5 ) ) </code> <output>Both printouts will return identical color, which at the time of testing is RGBA - 255, 244, 242, 255.</output> </example>