ColorAlpha

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

Contents

Description

Returns a new Color structure with the RGB components of the given Color structure and the alpha value specified.

Arguments

table color

The Color structure from which to take RGB values. This color will not be modified.

Arguments

number alpha

The new alpha value, a number between 0 and 255. Values above 255 will be clamped.

Returns

table

The new Color structure with the modified alpha value

Examples

Example

local red = Color( 255, 0, 0, 255 )
local red2 = ColorAlpha( red, 125 )
print( red.r, red.g, red.b, red.a )
print( red2.r, red2.g, red2.b, red2.a )

Output:

255	0	0	255
255	0	0	125
Personal tools
Navigation