chartPaletteOf function

List<int> chartPaletteOf(
  1. int argb
)

The colors of a chart's series or slices from a theme's accent (argb, 0xAARRGGBB): the accent, then seven colors of other hues, each as light and as strong as it (a hue that is light by nature, a yellow, a little lighter). An accent with no hue of its own (a black, a gray) is followed by colors of a moderate strength.

Implementation

List<int> chartPaletteOf(int argb) {
  final (lightness, chroma, own) = _oklch(argb >> 16 & 0xFF, argb >> 8 & 0xFF, argb & 0xFF);
  final hue = chroma < 0.03 ? 335.0 : own;
  final l = lightness.clamp(0.5, 0.72).toDouble(), c = chroma.clamp(0.1, 0.17).toDouble();
  return [
    argb,
    for (final turn in _turns.skip(1))
      () {
        final h = (hue + turn) % 360;
        return 0xFF000000 | _rgb(l + 0.14 * math.max(0, math.cos((h - 90) * math.pi / 180)), c, h);
      }(),
  ];
}