Is every icon unique?

A random question that just occurred to me. Those users who have not chosen to create an icon get a generic icon with the first letter of their username in a colored circle. If two users had the same first letter could they end up with identical icons? Or does the board software generate a different color for each icon using a letter so that each icon remains unique?

I’ve noticed posters whose names begin with the same letter will have a different colored background. For example, I’ve noticed a poster whose name begins with “C” who has an orange colored background. And I’ve noticed three posters whose names begin with “D” who all have different colored backgrounds.

I was just about to ask how many colors are in use for those lettered icons.

I investigated the HTML.

The icons are generated on the fly using a simple interface that specifies the letter to be used, the RGB color value in hex, and the size in pixels. Which means there are 256^3 = 16,777,216 possible colors for any given letter. Though humans (and their monitors) can’t discern nearly that many different colors in the gamut. Times 26 letters gives 436,207,616 possible icons. I don’t know if a Discourse username can start with a non-letter.

The icon generator always renders the given letter in uppercase in white. And is perfectly happy generating an all white icon with no visible letter if fed the appropriate color code. Or even other ASCII symbols instead of letters. I didn’t get out into testing Chinese Unicode, emojis, or anything else exotic before I lost interest.

I’d bet that when a new user is created their color code is chosen by a hash of something. With probably some filtering to prevent off-white or very pale colors.

My bottom line: Probably not formally guaranteed to be unique, but statistically unlikely to repeat very often.

Such fun manually abusing their API.

I just checked the “Members” category in “Groups.” Mostly the colors for posters with the same letter are noticeably different, but some are very subtle and are functionally the same since they would not be easily distinguishable unless side by side.

Coincidentally, it was your icon that prompted this thread. I saw it in another thread and I thought “If I hadn’t uploaded an icon, LSLGuy and I might have ended up the same icon.”

It’s a square, not a circle, in the theme I’m using (Straight Dope Light).

So it is (and, wow, is that theme bright). I use Vincent and icons are circles.

Heh. Your comfy (retired?) monkey is a far cooler icon than I could have come up with.

I use Sam’s Simple. Icons are square on the computer, but round on the phone.

I remember a Comments system from earlier in the Internet (was it Quora maybe?) that did a similar thing, generating a kind of tangram image of various colours, seemingly based off a hash that was consistent for me every time I used it even without an account, because I always had the same username.

So my guess is the hash they generate the colour code from is the username, making it a guaranteed unique hexcode.

Hashes are by definition not guaranteed to be unique.

Given the actual color + letter space of roughly 500M versus the actual number of users on SDMB from '99 to date, the odds on collisions are very low. So it’s statistically very likely that no 2 SDMB icons are the same. Although as @Colibri said, there are a lot of shades that only subtly different. Which is what we’d expect from an unfiltered hash function.

At the same time it’s a virtual certainty that across all the customer entities using Discourse times all their users there are many duplicate color+letter icons.

While we’re at it, an interesting question is how many Discourse users at SDMB and separately how many Discourse users at non-SDMB configure a custom icon vs the issued one. IOW, is the color+ letter icon meant sort of like a newbie temporary password; a short-term interim placeholder until the user supplies their own clever avatar? Or is the reality that many (most?) users stick with the letter + color.

With our skew towards older, tech non-savvy, long established SDMB personas, and conservative mien at least as to webby stuff, I’d bet we have far slower uptake of custom avatar icons versus some other Discourse site newly created in 2020 and targeted at teens or 20-somethings.

In the “better off without Republicans” Pit thread, there’s a spirited debate between MrMrmrmr and madmonk28. Their shades of off-yellow are different, but they’re very close. If msmith537 joins in, it’ll be really hard to tell who’s who…

Actually, I’d be surprised if there were no collisions on the SDMB. It’s like the birthday problem: The expected number of users before there’s a collision between icons is approximately the square root of the number of icons. And while we certainly don’t have 400 million users, we probably do have more than 20,000.

At least, I think so. It used to be easy to see how many members there were: You looked at the profile for the most recent person to join, and took their member ID number. But Discourse doesn’t seem to show member ID numbers-- Does anyone remember what the count was, or know some other way to find it?

https://boards.straightdope.com/about

Stats at the bottom of the page.

The API server is also open source and you can read the source at