// 7 Telegram-style author name colors, picked deterministically by owner id.
// Works for both light and dark themes (chosen for contrast).
const COLORS = [
  '#e17076', // red
  '#eda86c', // orange
  '#a695e7', // purple
  '#7bc862', // green
  '#65aadd', // blue
  '#ee7aae', // pink
  '#6ec9cb', // teal
];

export const authorColor = (id?: string | null): string => {
  const safe = id ?? '';
  let hash = 0;
  for (let i = 0; i < safe.length; i++) {
    hash = safe.charCodeAt(i) + ((hash << 5) - hash);
  }
  return COLORS[Math.abs(hash) % COLORS.length];
};
