Share via


ColorUtilities.GetContrastRatio(Color, Color) Method

Definition

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

Returns

Applies to