getPrimaryPalette method
TonalPalette
getPrimaryPalette(
- TonalPaletteSourceColor sourceColor,
- Variant variant,
- bool isDark,
- double contrastLevel,
- Platform platform,
- SpecVersion specVersion,
override
Implementation
@override
TonalPalette getPrimaryPalette(
TonalPaletteSourceColor sourceColor,
Variant variant,
bool isDark,
double contrastLevel,
Platform platform,
SpecVersion specVersion,
) => switch (variant) {
.neutral => .fromHueAndChroma(
sourceColor.asHct.hue,
platform == .phone
? (Hct.isBlue(sourceColor.asHct.hue) ? 12.0 : 8.0)
: (Hct.isBlue(sourceColor.asHct.hue) ? 16.0 : 12.0),
),
.tonalSpot => .fromHueAndChroma(
sourceColor.asHct.hue,
platform == .phone && isDark ? 26.0 : 32.0,
),
.expressive => .fromHueAndChroma(
sourceColor.asHct.hue,
platform == .phone ? (isDark ? 36.0 : 48.0) : 40.0,
),
.vibrant => .fromHueAndChroma(
sourceColor.asHct.hue,
platform == .phone ? 74.0 : 56.0,
),
_ => super.getPrimaryPalette(
sourceColor,
variant,
isDark,
contrastLevel,
platform,
specVersion,
),
};