Show HN: Default Avatar Generator

github.com

1 points by pas256 8 hours ago

After your team has signed up for a new SaaS or service, I find it bland when everyone has the same generic, grey avatar. I'm a visual person and find it helpful to distinguish users by colors in their avatars, but many people never change from the default avatar. So I thought to myself, why not generate interesting avatars for users when they sign up.

The result is this little gem. It randomly chooses from a set of backgrounds, colors and head shapes, and put a letter on the generated avatar. This should be enough combinations so the change of users getting the same avatar generated is next to zero. It can produce SVGs or JPEGs, depending on your use case. More styles can be added somewhat easily.

I'm already using it for https://magicell.com/ and haven't seen any duplicates.

I am very open to feedback on this so please let me know what you think.

gus_massa 5 hours ago

How is the background chosen? Can it be generated from a hash like Gravatar?

Also, I get an error when I go to magicell.

  • pas256 3 hours ago

    Each avatar has 3 layers: background, foreground (head), and text (single letter).

    The background code chooses from one of the background SVGs (gradients in different directions with color placeholders) and then selects colors to put into the SVG. The whole things is meant to be easy to extend to fit your needs.

    My understanding with Gravatar is that your email is hashed in order to select an avatar you have already uploaded, but is not used in customizing the avatar. Is that right?

    What did you have in mind?

    Also, what error do you get on Magicell? There are some geo-restrictions in place, so I am curious what you saw. Thanks!