diff --git a/ui/colony/src/components/MessageItem.tsx b/ui/colony/src/components/MessageItem.tsx index c087785..0303654 100644 --- a/ui/colony/src/components/MessageItem.tsx +++ b/ui/colony/src/components/MessageItem.tsx @@ -44,6 +44,15 @@ function renderContent(text: string) { }); } +// Stable OKLCH hue from username — same user always gets same color +function userHue(username: string): number { + let hash = 0; + for (let i = 0; i < username.length; i++) { + hash = username.charCodeAt(i) + ((hash << 5) - hash); + } + return Math.abs(hash) % 360; +} + export function MessageItem({ message, replyTarget, onReply }: Props) { const [metaOpen, setMetaOpen] = useState(false); const isAgent = message.user.role === "agent"; @@ -72,20 +81,23 @@ export function MessageItem({ message, replyTarget, onReply }: Props) {