withValues method

  1. @override
Color withValues({
  1. double? alpha,
  2. double? red,
  3. double? green,
  4. double? blue,
  5. ColorSpace? colorSpace,
})
override

Returns a new color with the provided components updated.

Each component (alpha, red, green, blue) represents a floating-point value; see Color.from for details and examples.

If colorSpace is provided, and is different than the current color space, the component values are updated before transforming them to the provided ColorSpace.

Example:

import 'dart:ui';
/// Create a color with 50% opacity.
Color makeTransparent(Color color) => color.withValues(alpha: 0.5);

Implementation

@override
Color withValues({
  double? alpha,
  double? red,
  double? green,
  double? blue,
  ColorSpace? colorSpace,
}) => _effectiveColor.withValues(
  alpha: alpha,
  red: red,
  green: green,
  blue: blue,
  colorSpace: colorSpace,
);