From DCS World Wiki - Hoggitworld.com


Added with: Mist 4.5
Converts a hexadecimal string into a color table in the format of {red, green, blue, alpha} indexed numerically in a color table with values from 0 to 255.

The optional value if present returns the value in a range of 0 to 1 for each value as used with the color tables passed to markup functions.

The mist function mist.marker.add automatically calls this if the value passed is a hexadecimal value.

table mist.utils.hexToRGB(string hex , boolean range )
Valid Input Values:
Return value:
Return example:
{0, 64, 64, 1}
Usage Examples:
The following references the color of a drawing named "samZone" and converts the value into an RGBA table.
 local ref = mist.DBs.drawingsByName['samZone']
 local rgbaColor = mist.uitls.hexToRGB(ref.colorString, true)
For whatever reason the mission file stores the color of drawings in hex while every other instance of color uses RGBA. The values stored here have an extra pair of characters ("0x") which this function will trim automatically. For example: "0x004040ff"
Related Functions
converter, toDegree, toRadian, round, roundTbl, metersToNM, metersToFeet, NMToMeters, feetToMeters, mpsToKnots, mpsToKmph, knotsToMps, kmphToMps, kelvinToCelsius, FahrenheitToCelsius, celsiusToFahrenheit, hexToRGB

Scripting Engine

MIST Root Page