hasSufficientContrast

fun Color.hasSufficientContrast(other: Color, threshold: ContrastThreshold = ContrastThreshold.WCAG_AA_NORMAL_TEXT): Boolean

Determines if the contrast ratio between two colors meets or exceeds a specified threshold.

For more details on WCAG guidelines, visit WCAG Guidelines.

Receiver

The first Color to compare.

Return

true if the contrast ratio is greater than or equal to the threshold, false otherwise.

Parameters

other

The second Color to compare.

threshold

The contrast ratio threshold to compare against.