create colored name avatars when no avatar picture is set

Bug #1550670 reported by swizzle
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Granite
Confirmed
Undecided
Unassigned
Mail
Confirmed
Wishlist
Unassigned

Bug Description

just what the title says. We've seen this in Android an iOS, it looks and works pretty well. Daniel Foré would be DF

description: updated
Changed in pantheon-mail:
importance: Undecided → Wishlist
Revision history for this message
Danielle Foré (danrabbit) wrote :

We'll probably want to create this functionality inside granite.widgets.avatar itself

I think we would want the colors to be consistent across apps, so we'll have to figure out some scheme for generating colors consistently. For example we could convert the name to hex (even 3 characters give us 6 characters in hex) and use the first 6 characters or something.

Changed in pantheon-mail:
status: New → Confirmed
Revision history for this message
Danielle Foré (danrabbit) wrote :

Alright so it sounds like this is what we need to do. Granite.Widgets.Avatar needs to be able to accept either a string or an image, but one of these should be mandatory. No more mystery man. Given a string, it should...

Get letters to display:

* Take the first two letters of the first two words. So if you give it "Gordon Ramsey", it takes "GR". If you give it "<email address hidden>" it takes "D".

Get a color to use:

* Take the first 3 characters of the string and convert that to hex.
* convert the hex to a HSL color.
* Maximize the saturation.

Getting the color with this formula instead of randomly means that given the same string you'll get the same filler-avatar across apps. So Gordon Ramsey is blue in Mail, Calendar, the session menu, the users plug, etc.

Sam Hewitt (snwh)
Changed in granite:
status: New → Confirmed
Revision history for this message
swizzle (el-ferreira-deactivatedaccount) wrote :

Sounds awesome! Back then you said replacing the shutdown icon by an avatar picture wouldn't look good because it is so small. What about a text avatar "DF" as a replacement for the shutdown icon?

Revision history for this message
swizzle (el-ferreira-deactivatedaccount) wrote :

PS: You're saying If you give it "<email address hidden>" it takes "D". I don't know if it is possible but maybe you could get the full name from the header or through the API instead of the email itself.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.