swapOnMaterial3 property

bool swapOnMaterial3
final

When using Material3 color system, this FlexSchemeColor should prefer to swap secondary and tertiary colors.

Set this flag to true, if this FlexSchemeColor's has a design that if Material 3 color system is used, will benefit if the secondary and tertiary colors, including their containers, are swapped.

Many legacy FlexColorScheme color schemes were designed for M2 and have this flag set to true. If this flag is false (default) it may mean that its FlexSchemeColor was designed for M3 or that it won't benefit from swapping secondary and tertiary colors.

This property does not cause swapping of any color information, it is only metadata that provides information that such swapping is beneficial when using the Material 3 color system for this particular FlexSchemeColor.

Using seed generated color scheme with the built-in FlexSchemeColor colors is another way to make them suitable for the M3 Color system. However, in some cases the secondary color in their design may not be in-line with M3 color system design intent, especially if you use seeded color schemes that also use chroma from the secondary color to make tonal palettes for it. However, in many of the legacy FlexSchemeColor color designs, this can be fixed if we swap the secondary and tertiary colors. Such FlexSchemeColor has since FlexColorScheme version 6.1.0 been configured with its swapOnMaterial3 property set to true. All others have it set to false.

To actually make such FlexSchemeColor automatically swap secondary and tertiary colors when useMaterial3 is set to true , set the FlexColorScheme property swapLegacyOnMaterial3 to true. It defaults to false for backwards compatibility, but it is recommended to turn it on when using Material 3 color system. If you use seeded color schemes with Material 2 (useMaterial3 flag is false), it may be preferable to keep swapOnMaterial3 false.

The Themes Playground app defaults to setting this value to true, but allows you to turn it off.

Defaults to false.

Implementation

final bool swapOnMaterial3;