BinarySkinProblem
class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Skinning
Describes two colours of a skin that are too alike: text that would be hard to read, or a change of
state a user could not see. BinarySkin.Validate returns these.
public sealed class BinarySkinProblem
Examples
foreach (BinarySkinProblem problem in skin.Validate())
{
// e.g. "SurfaceText on Hover - a command under the pointer: contrast 3.12, needs 4.5."
Trace.TraceWarning(problem.Description);
}Members at a glance
| Properties | |
|---|---|
Background | Gets the colour it is drawn on, or that it replaces. |
Contrast | Gets the contrast the two colours have. |
Description | Gets the problem in words, naming both colours, where they are seen and the two ratios. |
Foreground | Gets the colour drawn on top – or, for a change of state, the colour shown during it. |
RequiredContrast | Gets the contrast the two colours need. |
| Methods | |
ToString | Returns the problem in words. |
| Fields | |
StateChangeRatio | The contrast, 1.1, a command's pointer and pressed colours must have with the colour they replace for the change to be seen. |
Properties
Background
public BinarySkinColor Background
Gets the colour it is drawn on, or that it replaces.
- Value
- The role of the colour in the skin.
Contrast
public double Contrast
Gets the contrast the two colours have.
- Value
- A ratio from 1 (the same colour) to 21 (black on white), as
ColorContrast.Ratiomeasures it.
Description
public string Description
Gets the problem in words, naming both colours, where they are seen and the two ratios.
- Value
- For example "SecondaryText on Surface – group titles and menu descriptions: contrast 3.80, needs 4.5."
Foreground
public BinarySkinColor Foreground
Gets the colour drawn on top – or, for a change of state, the colour shown during it.
- Value
- The role of the colour in the skin.
RequiredContrast
public double RequiredContrast
Gets the contrast the two colours need.
- Value
- 4.5 for text, 3 for a line, or
StateChangeRatiofor a change of state.
Methods
Fields
StateChangeRatio
public const double StateChangeRatio
The contrast, 1.1, a command's pointer and pressed colours must have with the colour they replace for the change to be seen.