getSecondaryPalette method
TonalPalette
getSecondaryPalette(
- TonalPaletteSourceColor sourceColor,
- Variant variant,
- bool isDark,
- double contrastLevel,
- Platform platform,
- SpecVersion specVersion,
override
Implementation
@override
TonalPalette getSecondaryPalette(
TonalPaletteSourceColor sourceColor,
Variant variant,
bool isDark,
double contrastLevel,
Platform platform,
SpecVersion specVersion,
) => switch (variant) {
.content || .fidelity => .fromHueAndChroma(
sourceColor.asHct.hue,
math.max(sourceColor.asHct.chroma - 32.0, sourceColor.asHct.chroma * 0.5),
),
.fruitSalad => .fromHueAndChroma(
MathUtils.sanitizeDegreesDouble(sourceColor.asHct.hue - 50.0),
36.0,
),
.monochrome => .fromHueAndChroma(sourceColor.asHct.hue, 0.0),
.neutral => .fromHueAndChroma(sourceColor.asHct.hue, 8.0),
.rainbow => .fromHueAndChroma(sourceColor.asHct.hue, 16.0),
.tonalSpot => .fromHueAndChroma(sourceColor.asHct.hue, 16.0),
.expressive => .fromHueAndChroma(
DynamicScheme.getRotatedHue(
sourceColor.asHct,
[0.0, 21.0, 51.0, 121.0, 151.0, 191.0, 271.0, 321.0, 360.0],
[45.0, 95.0, 45.0, 20.0, 45.0, 90.0, 45.0, 45.0, 45.0],
),
24.0,
),
.vibrant => .fromHueAndChroma(
DynamicScheme.getRotatedHue(
sourceColor.asHct,
const [0.0, 41.0, 61.0, 101.0, 131.0, 181.0, 251.0, 301.0, 360.0],
const [18.0, 15.0, 10.0, 12.0, 15.0, 18.0, 15.0, 12.0, 12.0],
),
24.0,
),
_ => throw ArgumentError.value(
variant,
"variant",
"Variant is not supported in current spec.",
),
};