DiscordColor.fromScaledRgb constructor
Create a DiscordColor from r
, g
and b
channels ranging from 0.0 to 1.0 combined.
r
, g
and b
must be positive and less than or equal to 1.0
.
Implementation
factory DiscordColor.fromScaledRgb(double r, double g, double b) {
assert(r >= 0 && r <= 1, 'r must be between 0 and 1');
assert(g >= 0 && g <= 1, 'g must be between 0 and 1');
assert(b >= 0 && b <= 1, 'b must be between 0 and 1');
return DiscordColor.fromRgb(
(r * 255).floor(),
(g * 255).floor(),
(b * 255).floor(),
);
}