ColorUtilities.CompareContrastWithBlackAndWhite(Color) Method

Definition

Calculates the contrast ratio of the specified color against both black and white and returns which one has better contrast ratio.

public:
 static Microsoft::VisualStudio::PlatformUI::ContrastComparisonResult CompareContrastWithBlackAndWhite(System::Windows::Media::Color color);
public static Microsoft.VisualStudio.PlatformUI.ContrastComparisonResult CompareContrastWithBlackAndWhite (System.Windows.Media.Color color);
static member CompareContrastWithBlackAndWhite : System.Windows.Media.Color -> Microsoft.VisualStudio.PlatformUI.ContrastComparisonResult
Public Function CompareContrastWithBlackAndWhite (color As Color) As ContrastComparisonResult

Parameters

color
Color

A color which is assumed to be opaque.

Returns

ContrastComparisonResult

Which of black or white has highest contrast ratio, or if they are equal.

Applies to