getSecondaryPalette method

  1. @override
TonalPalette getSecondaryPalette(
  1. Variant variant,
  2. Hct sourceColorHct,
  3. bool isDark,
  4. Platform platform,
  5. double contrastLevel,
)
override

Implementation

@override
TonalPalette getSecondaryPalette(
  Variant variant,
  Hct sourceColorHct,
  bool isDark,
  Platform platform,
  double contrastLevel,
) => switch (variant) {
  .content || .fidelity => .fromHueAndChroma(
    sourceColorHct.hue,
    math.max(sourceColorHct.chroma - 32.0, sourceColorHct.chroma * 0.5),
  ),
  .fruitSalad => .fromHueAndChroma(
    MathUtils.sanitizeDegreesDouble(sourceColorHct.hue - 50.0),
    36.0,
  ),
  .monochrome => .fromHueAndChroma(sourceColorHct.hue, 0.0),
  .neutral => .fromHueAndChroma(sourceColorHct.hue, 8.0),
  .rainbow => .fromHueAndChroma(sourceColorHct.hue, 16.0),
  .tonalSpot => .fromHueAndChroma(sourceColorHct.hue, 16.0),
  .expressive => .fromHueAndChroma(
    DynamicScheme.getRotatedHue(
      sourceColorHct,
      [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(
      sourceColorHct,
      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,
  ),
};