FlexTones.highContrast constructor
- Brightness brightness
Creates a tonal palette extraction setup that results in M3 like ColorsSchemes with high contrast between color versus its on-color and main color, versus its container color.
Primary, Secondary and tertiary key colors use their own chroma, but with minimum limit of 65 on primary and 55 on secondary and tertiary.
Used tones are also modified from M3 defaults for increased contrast.
This tonal configuration can be used to turn any M3 theme into one that may be more accessibility since it offers increased contrast. You could apply a variant of the active theme with this tonal map to the high contrast theme data, thus providing increased contrast, but in the spirit of the original theme. It may still be useful to also provide purposefully designed optional extremely high contrast themes as options for the high contrast accessibility themes.
Implementation
factory FlexTones.highContrast(Brightness brightness) =>
brightness == Brightness.light
? const FlexTones.light(
primaryTone: 30,
tertiaryTone: 30,
tertiaryContainerTone: 95,
errorContainerTone: 95,
surfaceTintTone: 30,
surfaceTone: 99,
//
primaryMinChroma: 65,
secondaryMinChroma: 55,
tertiaryMinChroma: 55,
)
: const FlexTones.dark(
onPrimaryTone: 10,
onSecondaryTone: 10,
onTertiaryTone: 10,
onErrorTone: 10,
primaryContainerTone: 20,
secondaryContainerTone: 20,
tertiaryContainerTone: 20,
errorContainerTone: 20,
onErrorContainerTone: 90,
surfaceTone: 4,
onSurfaceTone: 96,
surfaceContainerLowestTone: 0,
surfaceContainerLowTone: 6,
//
primaryMinChroma: 65,
secondaryMinChroma: 55,
tertiaryMinChroma: 55,
);