Garry's Mod Wiki

Color:ToVector

  Vector Color:ToVector()

Description

Translates the Color into a Vector, losing the alpha channel. This will also range the values from 0 - 255 to 0 - 1

r / 255 -> x
g / 255 -> y
b / 255 -> z

This is the opposite of Vector:ToColor

Returns

1 Vector
The created Vector

Example

Useful when setting player colors, since the function requires a vector as argument.

Entity( 1 ):SetPlayerColor( Color( 220, 20, 60 ):ToVector() )
Output: Sets the player color for Player1 (only works if they are using a colorable player model)