keepPrimary property

bool keepPrimary
final

When using useKeyColors, set keepPrimary to true, to keep the resulting ColorScheme.primary color as defined by effective FlexColorScheme.primary input key color, while still letting all other colors derived from input primary key to be based on colors seeded from it.

This feature is useful if you want to lock the resulting ColorScheme.primary to an exact given color value, but still use this color as branding key for all other color values derived from primary key color. Typically you would use this when the primary color must match a given established brand color, typically in light theme mode where it can be used since the color is often designed to be printed on white paper.

When you use the primary color as input as key based color input for a tonal palette, the TonalPalette and from key based ColorScheme algorithm will typically not not return this exact color as the ColorScheme.primary color. Seed colors are used more as a way to "set the tone" for the desired theme, the exact same input color value will seldom become the actual ColorScheme.primary color. With keepPrimary set to true you can however enforce that.

Defaults to false.

Implementation

final bool keepPrimary;