targetContrast property
Returns the target contrast value.
The getter, targetContrast
, returns a double value that represents the
contrast ratio of a ZetaContrast object. The ratio can be either 4.53
or 8.33
,
depending on whether the contrast level of this instance is ZetaContrast.aa
or ZetaContrast.aaa
.
- When the object's contrast level is
aa
, the method returns4.53
. - When the object's contrast level is
aaa
, the method returns8.33
.
These values serve as benchmarks for the contrast between the colours on a app's text and background. Being able to measure and adjust this contrast plays a critical role in improving a app's accessibility.
Implementation
double get targetContrast {
switch (this) {
case ZetaContrast.aa:
return 4.53;
case ZetaContrast.aaa:
return 8.33;
}
}