rgb2css function

String rgb2css (
  1. num alpha,
  2. List<num> color
)

returns an rgba css string like rgba(255, 255, 255, 1) from the rgb color and alpha value

Implementation

String rgb2css(num alpha, List<num> color) {
  var rgb = color.map((e) => _clamp(0, 255, e.round())).toList();
  var r = rgb[0];
  var g = rgb[1];
  var b = rgb[2];

  return 'rgba($r, $g, $b, ${_clampNorm(alpha)})';
}