import 'package:flutter/material.dart';

/// Generates a deterministic color from a string input
Color generateColorFromName(String name) {
  if (name.isEmpty) return Colors.grey;
  
  // Use the hashCode of the name to generate a consistent color
  int hash = name.hashCode;
  
  // Use the hash to generate RGB values
  final r = (hash & 0xFF0000) >> 16;
  final g = (hash & 0x00FF00) >> 8;
  final b = hash & 0x0000FF;
  
  // Create a color with these RGB values
  return Color.fromARGB(255, r, g, b);
}
