calculateMinimumAlpha
open fun calculateMinimumAlpha(@ColorInt foreground: Int, @ColorInt background: Int, minContrastRatio: Float): Int(source)
Calculates the minimum alpha value which can be applied to foreground
so that would have a contrast value of at least minContrastRatio
when compared to background
.
Return
the alpha value in the range [0, 255] or -1 if no value could be calculated
Parameters
foreground
the foreground color
background
the opaque background color
minContrastRatio
the minimum contrast ratio