targetContrastRatio method

double targetContrastRatio(
  1. double? fontSize, {
  2. required bool bold,
})

Returns the required contrast ratio for the fontSize and bold setting.

Defined by http://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html

Implementation

double targetContrastRatio(double? fontSize, {required bool bold}) {
  final double fontSizeOrDefault = fontSize ?? _kDefaultFontSize;
  if ((bold && fontSizeOrDefault >= kBoldTextMinimumSize) ||
      fontSizeOrDefault >= kLargeTextMinimumSize) {
    return kMinimumRatioLargeText;
  }
  return kMinimumRatioNormalText;
}