CONTRAST

Determines which of the two specified colors has a higher contrast against the given color.

Syntax

=CONTRAST(color, dark, light, threshold)

=CONTRAST(color)

Arguments

ArgumentTypeDescription
colorColorThe color to use when determining contrast.
darkColor(Optional) The dark color to use. Defaults to black.
lightColor(Optional) The light color to use. Defaults to white.
thresholdNumber(Optional) The percentage threshold specifying where the transition from dark to light is. Defaults to 0.43

Examples

=CONTRAST("#00ff00")#000000ff
Determines whether #00ff00 (green) has higher contrast with black or white.

=CONTRAST("#ff0000", "#00ff00", "#0000ff", 0.2)#0000ffff
Determines whether #ff0000 (red) has higher contrast with #00ff00 (green) or #0000ff (blue).