SchemeFidelity constructor

SchemeFidelity({
  1. required Hct sourceColorHct,
  2. required bool isDark,
  3. required double contrastLevel,
})

Implementation

SchemeFidelity({
  required Hct sourceColorHct,
  required super.isDark,
  required super.contrastLevel,
}) : super(
        sourceColorArgb: sourceColorHct.toInt(),
        variant: Variant.fidelity,
        primaryPalette: TonalPalette.of(
          sourceColorHct.hue,
          sourceColorHct.chroma,
        ),
        secondaryPalette: TonalPalette.of(
          sourceColorHct.hue,
          math.max(sourceColorHct.chroma - 32.0, sourceColorHct.chroma * 0.5),
        ),
        tertiaryPalette: TonalPalette.fromHct(
          DislikeAnalyzer.fixIfDisliked(
            TemperatureCache(sourceColorHct).complement,
          ),
        ),
        neutralPalette: TonalPalette.of(
          sourceColorHct.hue,
          sourceColorHct.chroma / 8.0,
        ),
        neutralVariantPalette: TonalPalette.of(
          sourceColorHct.hue,
          (sourceColorHct.chroma / 8.0) + 4.0,
        ),
      );