withHue method

  1. @override
Color withHue(
  1. double hue, {
  2. bool replace = true,
})

Returns a new color that matches this color, but with its hue modified.

By default, the current hue is replaced with the given hue angle (from 0 to 360). When replace is false, the current hue will be rotated by the specified angle instead.

Note: The new color is specified in the OKLCH color space, which gives a more uniform perception of color than HSL, but uses different hue angles than the sRGB color space.

Implementation

@override
Color withHue(double hue, {bool replace = true}) {
  return ColorSwatch(
    $50: $50.withHue(hue, replace: replace),
    $100: $100.withHue(hue, replace: replace),
    $200: $200.withHue(hue, replace: replace),
    $300: $300.withHue(hue, replace: replace),
    $400: $400.withHue(hue, replace: replace),
    $500: $500.withHue(hue, replace: replace),
    $600: $600.withHue(hue, replace: replace),
    $700: $700.withHue(hue, replace: replace),
    $800: $800.withHue(hue, replace: replace),
    $900: $900.withHue(hue, replace: replace),
    $950: $950.withHue(hue, replace: replace),
  );
}