DiscordColor.fromDouble constructor

DiscordColor.fromDouble(
  1. double r,
  2. double g,
  3. double b
)

Construct color from individual color components with doubles Values should be from 0.0 to 1.0

Implementation

factory DiscordColor.fromDouble(double r, double g, double b) {
  final rb = (r * 255).toInt().clamp(0, 255);
  final gb = (g * 255).toInt().clamp(0, 255);
  final bb = (b * 255).toInt().clamp(0, 255);

  return DiscordColor.fromInt(rb << 16 | gb << 8 | bb);
}