ColorUtilities.GetContrastRatio(Color, Color) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the contrast ratio between foreground
and background
.
according to https://www.w3.org/TR/WCAG20/#contrast-ratiodef.
public static double GetContrastRatio (System.Windows.Media.Color foreground, System.Windows.Media.Color background);
static member GetContrastRatio : System.Windows.Media.Color * System.Windows.Media.Color -> double
Public Function GetContrastRatio (foreground As Color, background As Color) As Double
Parameters
- foreground
- Color
A foreground color which may be partially transparent
- background
- Color
A background color which is assumed to be opaque