Feature #44723
openIncrease the number of initials avatar background colors from 8 to 16
Description
The background color of the initials avatar is chosen from 8 colors based on user.id % 8, so 1 in 8 pairs of users with the same initials get exactly the same avatar (#44717).
The attached patch increases the number of colors to 16, which halves this probability. Even 16 colors cannot completely prevent such collisions, but more colors would require additional light, low-saturation colors, which are hard to distinguish at the small sizes at which avatars are displayed.
Current 8 colors:
![]()
Proposed 16 colors:
![]()
Notes on the colors:
- All colors are taken from Open Color, the palette already used in Redmine's stylesheets. All 12 chromatic hues are used, with at most two shades per hue.
- The colors were selected to maximize the smallest perceptual difference (OKLab deltaE) between any two colors. The result is 12.6, larger than the 10.9 of the current colors (red-7 and pink-5), so no pair is harder to tell apart than before.
- The text color for each background was chosen based on APCA contrast, which reflects legibility of white text on mid-tone colors better than the WCAG 2 contrast ratio. Light backgrounds use black text and the others use white text.
- Users with consecutive IDs get consecutive colors in the list, so the colors are ordered to make consecutive ones clearly different.
Files
Related issues
Updated by Go MAEDA 2 days ago
- Related to Feature #44717: Let users choose the colour of their initials avatar from the palette added
Updated by Marius BĂLTEANU 2 days ago
- Related to Feature #29824: Add user initials when Gravatar is disabled added
Updated by Marius BĂLTEANU 2 days ago
Go MAEDA wrote:
The attached patch increases the number of colors to 16, which halves this probability. Even 16 colors cannot completely prevent such collisions, but more colors would require additional light, low-saturation colors, which are hard to distinguish at the small sizes at which avatars are displayed.
On the same topic, using inline styles to generate a unique color was rejected at the time of implementation, details in #29824#note-34.
Updated by Go MAEDA 2 days ago
Marius BĂLTEANU wrote in #note-3:
On the same topic, using inline styles to generate a unique color was rejected at the time of implementation, details in #29824#note-34.
Thank you for the context. This patch still uses the avatar-color-* CSS classes without introducing inline styles. It only adds eight more classes, so themes can override all 16 colors.
Updated by Marius BĂLTEANU 2 days ago
Go MAEDA wrote in #note-4:
Thank you for the context. This patch still uses the
avatar-color-*CSS classes without introducing inline styles. It only adds eight more classes, so themes can override all 16 colors.
Yes, I think it's good enough for now, eventually in the future we can move to 32. We can also include this in minor versions if you think it's a good idea.
Updated by Go MAEDA 2 days ago
I would prefer not to include this in minor releases.
With this change, the avatar color changes for most existing users, which could be confusing after a minor update. Themes that override the current eight avatar-color-* classes would also need to add the new ones. I think the next major release is a better fit.
Updated by Go MAEDA about 20 hours ago
- Target version changed from Candidate for next major release to 7.1.0
Setting the target version to 7.1.0.