textAvatarHashColor function

Color textAvatarHashColor(
  1. String input
)

Stable fallback when no palette match exists.

Implementation

Color textAvatarHashColor(String input) {
  if (input.isEmptyOrNull) return Colors.grey;
  final hue = input.hashCode.abs() % 360;
  return HSLColor.fromAHSL(1, hue.toDouble(), 0.55, 0.48).toColor();
}