formatRgb method

  1. @override
String formatRgb()
override

Returns a string representing this color according to the CSS Object Model specification, such as rgb(247, 234, 186) or rgba(247, 234, 186, 0.2).

If this color is not displayable, a suitable displayable color is returned instead by clamping RGB channel values to the interval [0, 255].

Implementation

@override
String formatRgb() {
  final a = _clampa(opacity);
  return '${a == 1 ? "rgb(" : "rgba("}${_clampi(r)}, ${_clampi(g)}, ${_clampi(b)}${a == 1 ? ")" : ', $a)'}';
}