FlexCorePalette class

An intermediate concept between the key color for a UI theme, and a full color scheme. Five tonal palettes are generated, plus a default error palette if not provided.

This is a modification of package:material_color_utilities CorePalette, to make it possible to create Material-3 seeded ColorScheme using tonal palettes created from 3 different ARGB seed colors, where 2 are optional. As an addition to using only one as provided via material_color_utilities version CorePalette.of and here also via FlexCorePalette.of.

This implementation also has an unnamed constructor for the five main final FlexTonalPalette properties. Exposes the original version's private constructor FlexCorePalette.fromHueChroma, that is used by FlexCorePalette.of.

It adds a FlexCorePalette.fromSeeds constructor to enable creating the FlexTonalPalettes for primary, secondary and tertiary color groups using optional ARGB seed colors, for secondary and tertiary FlexTonalPalettes, instead of tying them down to same ARGB seed color used for the primary color group.

The core produced tonal palettes are primary, secondary, tertiary, neutral, neutralVariant and error.

Annotations

Constructors

FlexCorePalette({required FlexTonalPalette primary, required FlexTonalPalette secondary, required FlexTonalPalette tertiary, required FlexTonalPalette neutral, required FlexTonalPalette neutralVariant, FlexTonalPalette? error})
Creates a FlexCorePalette by providing FlexTonalPalettes for each tonal color palette in the Material 3 core palettes.
const
FlexCorePalette.fromHueChroma(double hue, double chroma, [FlexPaletteType paletteType = FlexPaletteType.common])
Create a standard Material 3 core tonal palette from Hue and Chroma.
FlexCorePalette.fromList(List<int> colors, [FlexPaletteType paletteType = FlexPaletteType.common])
Create a FlexCorePalette from a fixed-size list of ARGB color ints representing concatenated tonal palettes.
FlexCorePalette.fromSeeds({required int primary, int? secondary, int? tertiary, int? error, int? neutral, int? neutralVariant, double? primaryChroma, double? primaryMinChroma, double? secondaryChroma, double? secondaryMinChroma, double? tertiaryChroma, double? tertiaryMinChroma, double? tertiaryHueRotation, double? neutralChroma = 4, double? neutralMinChroma, double? neutralVariantChroma = 8, double? neutralVariantMinChroma, double? errorChroma, double? errorMinChroma, FlexPaletteType paletteType = FlexPaletteType.common})
Create a FlexCorePalette from one to three seed colors.
factory

Properties

error FlexTonalPalette
TonalPalette error colors getter, returns given final _error parameter, but if null falls to M3 default value FlexTonalPalette.of(25, 84).
no setter
hashCode int
Override hashcode.
no setteroverride
neutral FlexTonalPalette
TonalPalette for neutral colors. Typically hues of primary.
final
neutralVariant FlexTonalPalette
TonalPalette for neutralVariant colors. Typically hues of primary.
final
primary FlexTonalPalette
TonalPalette for primary colors.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
secondary FlexTonalPalette
TonalPalette for secondary colors.
final
tertiary FlexTonalPalette
TonalPalette for tertiary colors.
final

Methods

asList() List<int>
Returns a list of ARGB color ints from concatenated tonal palettes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Override toString.
override

Operators

operator ==(Object other) bool
Override the equality operator.
override

Static Methods

of(int argb, [FlexPaletteType paletteType = FlexPaletteType.common]) FlexCorePalette
Create a FlexCorePalette from a given int ARGB color value.

Constants

size → const int
The number of generated tonal palettes.