Improved “letter avatar” generation

Saw this on another forum, thought the shadow looked quite nice and wondered if it might be an easy addition to the code that generates default avatars for Discourse users?

That’s a custom avatar - you can see the actual letter avatar at the top of the screenshot.

1 Like

Yes - I know. I’m proposing a change to the code that generates letter avatars (to add the shadow that was manually added to this custom avatar)

It’s a style thing, so it’d need to be a plugin local to that site.

With respect, is the core Discourse style not open to the occasional design tweak?

Maybe, but I think that’s a fairly radical departure from what we have, going from flat to non-flat.

You don’t actually need to patch Discourse. You go into the admin settings area and change the external system avatars url setting to point at your own web service that generates the avatars in whatever style you want.

Patch this thing:


Brilliant, @notriddle - exactly what I was hoping for :+1:


If you end up making your own version of letter generation @ChrisBeach we’d love to hear about it. It’d make for a great tutorial, and longer term it would be pretty cool to have a modular avatar generator that lets you choose between different styles and algorithms.


We do already have a modular avatar generator; the letter-avatars service is quite capable of providing differently styled avatars if you hit a different base URL. I’d be happy to review a PR that added a separate /drop-shadows endpoint that people could point their external system avatars url at. There’s a reasonable chance we’d even expose it on the CDN-backed service (the default external avatars service). Gotta get the code written first, though, and as a veteran of the “why the f*&$%%k isn’t this centered” wars of 2015 and 2016, it is not as trivial as it might at first appear.


Typography is tougher than it looks!


So true