Page tree
Skip to end of metadata
Go to start of metadata




Introduced in

Version:1.45

Description

Description:Converts a color name into an RGB array.

Naming follows the W3C standard.

In addition, "vbsorange" returns the standard VBS2 shade of orange: [1,0.5.0]

Syntax

Syntax:[name, alpha] call fn_vbs_colorByName
Parameters:
  • name: String - Color name.
  • alpha: Number - Alpha value to use (optional, default: 1).
Return Value:Color - [R,G,B,A] (if no color is found, [0,0,0,1] is returned).

Warning

When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Category VBS Scripting Functions.

Examples

Examples:
["yellow"] call fn_vbs_colorByName; // Returns: [1,1,0,1]
["brown",0.5] call fn_vbs_colorByName; // Returns: [0.647,0.164,0.164,0.5]


Demo mission: ColorPicker.zip

Additional Information

See also:
Multiplayer:
Problems:

Notes