colorHexToO function

Syntax

  • float colorHexToO(hexValue)

Parameters

  1. hexValue—string
    Hexadecimal color string in the format "#rrggbb" or "#rrggbboo"

Returns

Returns O value in [0,1] from hexadecimal color string in the format "#rrggbboo" where "oo" are the opacity values.

Description

The colorHexToO extracts the opacity value from a hexadecimal color string and converts it to a value in [0,1]. Returns 0 if hexadecimal string is too short.

Related

Examples

colorHexToO("#4080BF80")
# result = 0.5019607843137256
colorHexToO("#4080BF")
# result = 0