align gradient selection with cozy-ui frontend#4841
Merged
Conversation
Backend now matches cozy-ui's Avatar/helpers.js: - getInitialsColorHash uses rune iteration (like Array.from().charCodeAt()) instead of raw bytes - extractInfo now hashes the initials (getInitials) instead of the full publicName, matching cozy-ui which hashes whatever string is displayed as children - cozyUIAvatarColorSchemes is now an ordered slice in the same declaration order as cozy-ui's supportedColors, instead of an alphabetically-sorted map This fixes two mismatches: 1. Front-vs-back: both hash and palette selection are now identical, so the same input string produces the same gradient on both sides. 2. Back-vs-back: /public/avatar?fallback=initials (public.go) passed the raw publicName to GenerateInitials, while /sharings/.../recipients/:idx/avatar (sharings.go:1080) pre-uppercased it with strings.ToUpper. The old case- sensitive byte hash produced different sums -> different gradients for the same person on two routes. Now extractInfo hashes the initials from the shared code path, so both routes hash the same string.
JF-Cozy
force-pushed
the
fix/avatar-colors-front-back-alignment
branch
from
July 6, 2026 14:28
8330170 to
688954b
Compare
taratatach
approved these changes
Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backend now matches cozy-ui's Avatar/helpers.js:
Array.from().charCodeAt()) instead of raw bytes
the full publicName, matching cozy-ui which hashes whatever
string is displayed as children
declaration order as cozy-ui's supportedColors, instead of
an alphabetically-sorted map
This fixes two mismatches:
Front-vs-back: both hash and palette selection are now
identical, so the same input string produces the same
gradient on both sides.
Back-vs-back: /public/avatar?fallback=initials (public.go)
passed the raw publicName to GenerateInitials, while
/sharings/.../recipients/:idx/avatar (sharings.go:1080)
pre-uppercased it with strings.ToUpper. The old case-
sensitive byte hash produced different sums -> different
gradients for the same person on two routes. Now extractInfo
hashes the initials from the shared code path, so both routes
hash the same string.