Functions to measure and maximize accessibility.
Get the relative luminance of a color represented as a Float.
Formula based on: https://www.w3.org/TR/WCAG20/#relativeluminancedef
luminance Color.black -- 0.0
luminance Color.white -- 1.0Returns the color with the highest contrast to the base color.
bgColor = Color.darkBlue
textOptions = [ Color.white, Color.purple, Color.black ]
maximumContrast bgColor textOptions -- Just Color.white
Get the contrast ratio of two colors represented as a Float.
Formula based on: https://www.w3.org/TR/WCAG20/#contrast-ratiodef