Garry's Mod Wiki

Revision Difference

Color:ToVector#514294

<function name="ToVector" parent="Color" type="classfunc">⤶ <description>⤶ Translates the <page>Color</page> into a <page>Vector</page>, losing the alpha channel.⤶ This will also range the values from 0 - 255 to 0 - 1⤶ ⤶ r / 255 -&amp;gt; x&amp;lt;br&amp;gt;⤶ g / 255 -&amp;gt; y&amp;lt;br&amp;gt;⤶ b / 255 -&amp;gt; z⤶ ⤶ This is the opposite of <page>Vector:ToColor</page>⤶ </description>⤶ <realm>Shared</realm>⤶ <rets>⤶ <ret name="" type="Vector">The created <page>Vector</page></ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Useful when setting player colors, since the function requires a vector as argument.</description>⤶ <code>Entity( 1 ):SetPlayerColor( Color( 220, 20, 60 ):ToVector() )</code>⤶ <output>Sets the player color for Player1 (only works if they are using a colorable player model)</output>⤶ ⤶ </example>