getHct method

Hct getHct(
  1. DynamicScheme scheme
)

Return a color, expressed in the HCT color space, that this DynamicColor is under the conditions in scheme.

scheme Defines the conditions of the user interface, for example, whether or not it is dark mode or light mode, and what the desired contrast level is.

Implementation

Hct getHct(DynamicScheme scheme) {
  final cachedAnswer = _hctCache[scheme];
  if (cachedAnswer != null) {
    return cachedAnswer;
  }
  final tone = getTone(scheme);
  final answer = palette(scheme).getHct(tone);
  if (_hctCache.length > 4) {
    _hctCache.clear();
  }
  _hctCache[scheme] = answer;
  return answer;
}