ensureAccessibility method

Color ensureAccessibility({
  1. required Color on,
  2. ZetaContrast standard = ZetaContrast.aa,
})

Adjusts the current color to meet the specified accessibility standard standard when set against the on color.

By default, the AA accessibility standard is targeted. You can optionally target AAA. AA: The contrast ratio should be at least 4.57:1 AAA: The contrast ratio should be at least 8.33:1

Returns the adjusted color that meets the specified accessibility standard. Adjusts the current color to meet a specified accessibility standard standard when set against the on color.

Implementation

Color ensureAccessibility({
  required Color on,
  ZetaContrast standard = ZetaContrast.aa,
}) {
  return adjustContrast(on: on, target: standard.targetContrast);
}