Description
Feature Request
Is your feature request related to a problem? Please describe.
User avatar colours are generated using the username string. On forums that use single sign on and do not rely on user input for the display name (e.g. may use numerical username user1, user2, user3) the colours are almost all the same for every user.
Describe the solution you'd like
The function for generating the colour should instead use the nickname so that whichever display driver is set will be used to generate the colours.
I assume we could just substitute display name into the existing color function.
color: computed('displayName', 'avatarUrl', 'avatarColor', function (displayName, avatarUrl, avatarColor) {
// If we've already calculated and cached the dominant color of the user's
// avatar, then we can return that in RGB format. If we haven't, we'll want
// to calculate it. Unless the user doesn't have an avatar, in which case
// we generate a color from their display name.
if (avatarColor) {
return 'rgb(' + avatarColor.join(', ') + ')';
} else if (avatarUrl) {
this.calculateAvatarColor();
return '';
}
return '#' + stringToColor(displayName);
}),
Justify why this feature belongs in Flarum's core, rather than in a third-party extension
The display driver is a core feature.
Describe alternatives you've considered
Workarounds are to get users to set an avatar so the colour gets generated from it but it cannot be forced.