colorHexToO function

float colorHexToO(hexValue)

hexValue string Hexadecimal color string in the format "#rrggbboo"

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

This function 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