TOCOLOR function

TOCOLOR(Value) TOCOLOR(Value)

Value

Number, Logical, Text, Color, { Number }, { Logical }, { Text } or { Color }

The value to convert.

Returns

Color or { Color }

The given value converted to a color.

Returns the given value converted to a color. TOCOLOR("red")TOCOLOR("red") returns a fully-saturated red color.

When the sole parameter is a color, it is returned unchanged. When it is a text string, TOCOLOR behaves identically to the COLOR function (refer to its documentation for more information on its features). When the parameter is a logical value, TRUE is converted to white and FALSE to black.

When the sole parameter is a number, it is expected to represent the raw color value, which is a 32-bit number incorporating color components adhering to the ARGB color model. The least significant eight bits represent the blue color component, the next eight bits represent the green color component and the eight following bits represent the red color component. The most significant eight bits represent the alpha value, where a value of 0 means that the color is fully transparent and a value of 255 means that the color is fully opaque.

This function is specific to Calcapp.

Examples

TOCOLOR("red")TOCOLOR("red")

Returns a color corresponding to a deeply saturated red color.

COLOR("red")COLOR("red")

Returns a color corresponding to a deeply saturated red color. COLOR and TOCOLOR are equivalent when used with a text parameter.

TOCOLOR("Red A100")TOCOLOR("Red A100")

Returns a color corresponding to a pale red color.

Color.RedColor,Red

Returns a color corresponding to a deeply saturated red color. Color.RedColor,Red is identical to TOCOLOR("RED")TOCOLOR("RED"), but has the added advantage that typos are flagged immediately instead of only when the app is run. Writing Color., followed by the color name, only works for named colors, though, whereas the TOCOLOR function also works with hex notation and with color models. Also, the TOCOLOR function is case-insensitive, meaning that TOCOLOR("RED")TOCOLOR("RED") works, but Color.REDColor,RED does not. Refer to the documentation for the COLOR function for more information.

TOCOLOR(TRUE)TOCOLOR(TRUE)

Returns white.

TOCOLOR(FALSE)TOCOLOR(FALSE)

Returns black.

TOCOLOR(HEX2DEC("FF00FF00"))TOCOLOR(HEX2DEC("FF00FF00"))

Returns a color corresponding to a deeply saturated green color.