Hacker News new | ask | show | jobs
by Mordisquitos 1852 days ago
> The really boring approach IMO is to choose a random solid color and put the user's initial(s) on top of it. This makes it pretty unique and much easier to associate someone back to their avatar.

I agree that it's a good simple baseline, but going on a minor off-topic rant, I find it very annoying when this is implemented under the anglocentric assumption of names always being of the format Firstname (Middlename) Surname everywhere, and thus always parsing the initials as "FS". As a result, Spanish people whose naming custom is Firstname(s) 1stSurname 2ndSurname, where the 2nd surname is the "droppable" one, are inappropriately rendered. Director Pedro Almodóvar Caballero becomes "PC", rather than the acceptable versions "PA" or "PAC".

3 comments

This is why "first name" should be "given name" and "last name" should be "surname". There are many assumptions programmers make about names, but this one is particularly annoying for CJK and other cultures.

I've had the opposite issue in Korea. Several systems expected LastFirst (from my perspective).

This is something I really appreciate about Faker[1], a library that generates random data to seed your development DB with. It will throw you about as many curveballs than obvious 'happy path' names, addresses, phone numbers and whatnot.

[1]: https://fakerphp.github.com/

I love that library, I use it for Python all the time.

In fact, it has a function to generate random hex colors too, and you can even filter it to only generate darker colors so you can create nice looking random avatar circles with a white text color to ensure you get good contrast ratios without having to worry about doing a YIQ based contrast calculation.

Technically it's "implemented" as a javascript library that you can edit and customize to fit your specific needs and use cases.

Just because the default example is based on one set of assumptions does not mean the project is inherently limited or biased.

I was talking from the perspective of the end user of a product, not as a developer making use of a library.