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) {
  .neutral => .fromHueAndChroma(
    sourceColorHct.hue,
    platform == .phone
        ? (Hct.isBlue(sourceColorHct.hue) ? 6.0 : 4.0)
        : (Hct.isBlue(sourceColorHct.hue) ? 10.0 : 6.0),
  ),
  .tonalSpot => .fromHueAndChroma(sourceColorHct.hue, 16.0),
  .expressive => .fromHueAndChroma(
    DynamicScheme.getRotatedHue(
      sourceColorHct,
      const [0.0, 105.0, 140.0, 204.0, 253.0, 278.0, 300.0, 333.0, 360.0],
      const [-160.0, 155.0, -100.0, 96.0, -96.0, -156.0, -165.0, -160.0],
    ),
    platform == .phone ? (isDark ? 16.0 : 24.0) : 24.0,
  ),
  .vibrant => .fromHueAndChroma(
    DynamicScheme.getRotatedHue(
      sourceColorHct,
      const [0.0, 38.0, 105.0, 140.0, 333.0, 360.0],
      const [-14.0, 10.0, -14.0, 10.0, -14.0],
    ),
    platform == .phone ? 56.0 : 36.0,
  ),
  _ => super.getSecondaryPalette(
    variant,
    sourceColorHct,
    isDark,
    platform,
    contrastLevel,
  ),
};