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
Argument | Type | Description |
---|---|---|
color | Color | The color to use when determining contrast. |
dark | Color | (Optional) The dark color to use. Defaults to black. |
light | Color | (Optional) The light color to use. Defaults to white. |
threshold | Number | (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).
Updated 3 months ago