Garry's Mod Wiki

Revision Difference

Vector:ToColor#512420

<function name="ToColor" parent="Vector" type="classfunc">⤶ <description>⤶ Translates the <page>Vector</page> (values ranging from 0 to 1) into a <page>Color</page>. This will also range the values from 0 - 1 to 0 - 255.⤶ ⤶ x * 255 -&amp;gt; r&amp;lt;br&amp;gt;⤶ y * 255 -&amp;gt; g&amp;lt;br&amp;gt;⤶ z * 255 -&amp;gt; b⤶ ⤶ This is the opposite of <page>Color:ToVector</page>⤶ </description>⤶ <realm>Shared</realm>⤶ <rets>⤶ <ret name="" type="table">The created <page>Color</page>.</ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Get the Player1's player model color but in RGB</description>⤶ <code>print( Entity( 1 ):GetPlayerColor( ):ToColor( ) )</code>⤶ <output>Prints the player color of Player1 in RGB instead of a Vector</output>⤶ ⤶ </example>