toHex
This function is used by Ignition's Expression language.
Description​
Returns a hex formatted string representing the unsigned integer argument. If the argument is negative, the hex string represents the value plus 232.
Syntax​
toHex(number)
Parameters​
Type | Parameter | Description |
---|---|---|
Integer | number | The number to convert to hex. |
Results​
String - A string that is the hex value of the specified value.
New in 8.1.21
toHex(color)
Parameters​
Type | Parameter | Description |
---|---|---|
Color | color | An RGBA set to convert to hex. |
Results​
String - A string that is the hex value of the specified value.
Examples​
Code Snippet
toHex(255) //returns "FF"
Code Snippet
toHex(-255) //returns "FFFFFF01"
Code Snippet
toHex(color(192,26,68,241)) //Returns "C01A44F1"