shiftHue static method

Color shiftHue(
  1. Color color,
  2. double hueShift, {
  3. double saturationFactor = 1.0,
  4. double lightnessFactor = 1.0,
})

Implementation

static Color shiftHue(
  Color color,
  double hueShift, {
  double saturationFactor = 1.0,
  double lightnessFactor = 1.0,
}) {
  final hsl = HSLColor.fromColor(color);
  return hsl
      .withHue((hsl.hue + hueShift * 360) % 360)
      .withSaturation(
          (hsl.saturation * saturationFactor).clamp(0.0, 1.0).toDouble())
      .withLightness(
          (hsl.lightness * lightnessFactor).clamp(0.0, 1.0).toDouble())
      .toColor();
}