Show / Hide Table of Contents

Class ContrastTests

Get ContrastDisplay objects containing results for each contrast test, given a foreground color and a background color.

Inheritance
System.Object
ContrastTests
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Phoenix.Tiresias
Assembly: Phoenix.Plugin.Tiresias.dll
Syntax
public class ContrastTests

Fields

View Source

ColorBrightnessDiffThreshold

Contrast testing threshold for color brightness.

Declaration
public const double ColorBrightnessDiffThreshold = 125
Field Value
Type Description
System.Double
View Source

ColorDiffThreshold

Contrast testing threshold for color difference.

Declaration
public const double ColorDiffThreshold = 500
Field Value
Type Description
System.Double
View Source

Fail

Failing result.

Declaration
public const string Fail = "Fail"
Field Value
Type Description
System.String
View Source

HighContrastTextThreshold

Contrast testing threshold for high contrast text.

Declaration
public const double HighContrastTextThreshold = 7
Field Value
Type Description
System.Double
View Source

NonTextThreshold

Contrast testing threshold for non text.

Declaration
public const double NonTextThreshold = 3
Field Value
Type Description
System.Double
View Source

NotApplicable

N/A result.

Declaration
public const string NotApplicable = "n/a"
Field Value
Type Description
System.String
View Source

Pass

Passing result.

Declaration
public const string Pass = "Pass!"
Field Value
Type Description
System.String
View Source

TargetLargeTextThreshold

Contrast testing threshold for large text.

Declaration
public const double TargetLargeTextThreshold = 3
Field Value
Type Description
System.Double

Properties

View Source

ColorBrightnessNum

Gets or sets the color brightness number.

Declaration
public double ColorBrightnessNum { get; set; }
Property Value
Type Description
System.Double
View Source

ColorDifferenceNum

Gets or sets the color difference number.

Declaration
public double ColorDifferenceNum { get; set; }
Property Value
Type Description
System.Double
View Source

ContrastRatioNum

Gets or sets the contrast ratio number.

Declaration
public double ContrastRatioNum { get; set; }
Property Value
Type Description
System.Double
View Source

DeutContrastRatioNum

Gets or sets the deuteranopia contrast ratio number.

Declaration
public double DeutContrastRatioNum { get; set; }
Property Value
Type Description
System.Double
View Source

DeutLargeText

Gets or sets the ContrastDisplay object containing the test for deuteranopia large text.

Declaration
public ContrastDisplay DeutLargeText { get; set; }
Property Value
Type Description
ContrastDisplay
View Source

DeutNonText

Gets or sets the ContrastDisplay object containing the test for deuteranopia non-text.

Declaration
public ContrastDisplay DeutNonText { get; set; }
Property Value
Type Description
ContrastDisplay
View Source

DeutText

Gets or sets the ContrastDisplay object containing the test for deuteranopia text.

Declaration
public ContrastDisplay DeutText { get; set; }
Property Value
Type Description
ContrastDisplay
View Source

LargeTextHighContrast

Gets or sets the ContrastDisplay object containing the test for the large text high contrast.

Declaration
public ContrastDisplay LargeTextHighContrast { get; set; }
Property Value
Type Description
ContrastDisplay
View Source

LargeTextTargetContrast

Gets or sets the ContrastDisplay object containing the test for the large text target contrast.

Declaration
public ContrastDisplay LargeTextTargetContrast { get; set; }
Property Value
Type Description
ContrastDisplay
View Source

MonoContrastRatioNum

Gets or sets the monochromacy contrast ratio number.

Declaration
public double MonoContrastRatioNum { get; set; }
Property Value
Type Description
System.Double
View Source

MonoLargeText

Gets or sets the ContrastDisplay object containing the test for monochromacy large text.

Declaration
public ContrastDisplay MonoLargeText { get; set; }
Property Value
Type Description
ContrastDisplay
View Source

MonoNonText

Gets or sets the ContrastDisplay object containing the test for monochromacy non-text.

Declaration
public ContrastDisplay MonoNonText { get; set; }
Property Value
Type Description
ContrastDisplay
View Source

MonoText

Gets or sets the ContrastDisplay object containing the test for monochromacy text.

Declaration
public ContrastDisplay MonoText { get; set; }
Property Value
Type Description
ContrastDisplay
View Source

NonTextTargetContrast

Gets or sets the ContrastDisplay object containing the test for non-text.

Declaration
public ContrastDisplay NonTextTargetContrast { get; set; }
Property Value
Type Description
ContrastDisplay
View Source

ProtContrastRatioNum

Gets or sets the protanopia contrast ratio number.

Declaration
public double ProtContrastRatioNum { get; set; }
Property Value
Type Description
System.Double
View Source

ProtLargeText

Gets or sets the ContrastDisplay object containing the test for protanopia large text.

Declaration
public ContrastDisplay ProtLargeText { get; set; }
Property Value
Type Description
ContrastDisplay
View Source

ProtNonText

Gets or sets the ContrastDisplay object containing the test for protanopia non-text.

Declaration
public ContrastDisplay ProtNonText { get; set; }
Property Value
Type Description
ContrastDisplay
View Source

ProtText

Gets or sets the ContrastDisplay object containing the test for protanopia text.

Declaration
public ContrastDisplay ProtText { get; set; }
Property Value
Type Description
ContrastDisplay
View Source

TargetTextThreshold

Gets or sets the contrast testing threshold for text.

Declaration
public static double? TargetTextThreshold { get; set; }
Property Value
Type Description
System.Nullable<System.Double>
View Source

TextHighContrast

Gets or sets the ContrastDisplay object containing the test for the high contrast.

Declaration
public ContrastDisplay TextHighContrast { get; set; }
Property Value
Type Description
ContrastDisplay
View Source

TextTargetContrast

Gets or sets the ContrastDisplay object containing the test for the target contrast.

Declaration
public ContrastDisplay TextTargetContrast { get; set; }
Property Value
Type Description
ContrastDisplay
View Source

TritContrastRatioNum

Gets or sets the tritanopia contrast ratio number.

Declaration
public double TritContrastRatioNum { get; set; }
Property Value
Type Description
System.Double
View Source

TritLargeText

Gets or sets the ContrastDisplay object containing the test for tritanopia large text.

Declaration
public ContrastDisplay TritLargeText { get; set; }
Property Value
Type Description
ContrastDisplay
View Source

TritNonText

Gets or sets the ContrastDisplay object containing the test for tritanopia non-text.

Declaration
public ContrastDisplay TritNonText { get; set; }
Property Value
Type Description
ContrastDisplay
View Source

TritText

Gets or sets the ContrastDisplay object containing the test for tritanopia text.

Declaration
public ContrastDisplay TritText { get; set; }
Property Value
Type Description
ContrastDisplay

Methods

View Source

CheckColorBrightness(Color, Color)

Runs Color Brightness algorithm and determines if difference passes WCAG 2.0 guidelines.

Declaration
public void CheckColorBrightness(Color foregroundColor, Color backgroundColor)
Parameters
Type Name Description
System.Drawing.Color foregroundColor

The foreground color selected as part of the worst contrast pair for the line of text.

System.Drawing.Color backgroundColor

The background color selected as part of the worst contrast pair for the line of text.

View Source

CheckColorDifferenceTest(Color, Color)

Runs Color Difference algorithm and determines if difference passes WCAG 2.0 guidelines.

Declaration
public void CheckColorDifferenceTest(Color foregroundColor, Color backgroundColor)
Parameters
Type Name Description
System.Drawing.Color foregroundColor

The foreground color selected as part of the worst contrast pair for the line of text.

System.Drawing.Color backgroundColor

The background color selected as part of the worst contrast pair for the line of text.

View Source

CheckLuminanceTest(Color, Color)

Checks whether or not the selected colors pass the selected algorithm test.

Declaration
public void CheckLuminanceTest(Color foregroundColor, Color backgroundColor)
Parameters
Type Name Description
System.Drawing.Color foregroundColor

The foreground color selected as part of the worst contrast pair for the line of text.

System.Drawing.Color backgroundColor

The background color selected as part of the worst contrast pair for the line of text.

View Source

ContrastRatio(Color, Color)

Returns the contrast ratio. Can range from 1 - 21 (commonly written as 1:1 to 21:1) https://www.w3.org/TR/WCAG20/#contrast-ratiodef.

Declaration
public static double ContrastRatio(Color fore, Color back)
Parameters
Type Name Description
System.Drawing.Color fore

Foreground color.

System.Drawing.Color back

Background color.

Returns
Type Description
System.Double

contrast ratio of 2 colors.

View Source

MakePixelDeuteranopia(Color)

Called to apply the deuteranopia filter to a single pixel color.

Declaration
public static Color MakePixelDeuteranopia(Color color)
Parameters
Type Name Description
System.Drawing.Color color

A color represented in RGB.

Returns
Type Description
System.Drawing.Color

Color of filtered color.

View Source

MakePixelGrayscale(Color)

Returns Color type filled with gray value of colorful Color type.

Declaration
public static Color MakePixelGrayscale(Color pixel)
Parameters
Type Name Description
System.Drawing.Color pixel

Single unfiltered pixel.

Returns
Type Description
System.Drawing.Color

Single grayscale pixel.

View Source

MakePixelProtanopia(Color)

Called to apply the protanopia filter to a single pixel color.

Declaration
public static Color MakePixelProtanopia(Color color)
Parameters
Type Name Description
System.Drawing.Color color

A color represented in RGB.

Returns
Type Description
System.Drawing.Color

Color of filtered color.

View Source

MakePixelTritanopia(Color)

Called to apply the tritanopia filter to a single pixel color.

Declaration
public static Color MakePixelTritanopia(Color color)
Parameters
Type Name Description
System.Drawing.Color color

A color represented in RGB.

Returns
Type Description
System.Drawing.Color

Color of filtered color.

  • View Source
In This Article
Back to top Generated by DocFX