getHct method

  1. @override
Hct getHct(
  1. DynamicScheme scheme,
  2. DynamicColor color
)
override

Implementation

@override
Hct getHct(DynamicScheme scheme, DynamicColor color) {
  // This is crucial for aesthetics: we aren't simply the taking the standard color
  // and changing its tone for contrast. Rather, we find the tone for contrast, then
  // use the specified chroma from the palette to construct a new color.
  //
  // For example, this enables colors with standard tone of T90, which has limited chroma, to
  // "recover" intended chroma as contrast increases.
  final palette = color.palette(scheme);
  final tone = getTone(scheme, color);
  final hue = palette.hue;
  final chromaMultiplier = color.chromaMultiplier?.call(scheme) ?? 1.0;
  final chroma = palette.chroma * chromaMultiplier;

  return Hct.from(hue, chroma, tone);
}