Color/ToVector

From Garry's Mod
Jump to: navigation, search
 Color:ToVector( )

Contents

Description

Translates the Color structure 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

Vector

The created Vector

Examples

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)
Personal tools
Navigation