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.
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.