colorHexToO function

Syntax

  • string colorHexToO(hex)

Parameters

  1. hex—string
    Hex color string in the format "#rrggbb" or "#rrggbboo"

Returns

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

Description

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

Related

Examples

example.1
	colorHexToO("#4080BF80")
	# result = 0.5019607843137256

example.2
	colorHexToO("#4080BF")
	# result = 0

In this topic