Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use account initial as default avatar #4002

Merged

Conversation

kontrollanten
Copy link
Contributor

Description

Change default avatar to account name initial.

Related issues

closes #3935

Has this been tested?

  • 👍 yes, light tests as follows are enough
  1. Check avatar on account page.
  2. Check avatar on channel page.
  3. Check avatar in notifications.
  4. Check avatar in comments.
  5. Check avatar in comment add component.
  6. Check avatar in video watch page.
  7. Check avatar in my subscriptions.

Screenshots

image

@kontrollanten
Copy link
Contributor Author

The failed test seems unrelated.

Copy link
Collaborator

@rigelk rigelk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I would opt for a different colour generation method based on the name.

Comment on lines +46 to +61
private getColorTheme () {
const themes = {
abc: 'blue',
def: 'green',
ghi: 'purple',
jkl: 'gray',
mno: 'yellow',
pqr: 'orange',
stv: 'red',
wxyz: 'dark-blue'
}

const theme = Object.keys(themes).find(chars => chars.includes(this.initial))

return themes[theme]
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a simple hash-based colour generation function, which allows more diversity even for two names beginning by the same letter.
i.e. https://stackoverflow.com/questions/3426404/create-a-hexadecimal-colour-based-on-a-string-with-javascript

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice, but how do we ensure the contrast between text and bg is good? And can it be an ugly UI if we just generate random colors?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can generate colors in a restricted color space.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry but I don't understand how this should be implemented. Shall we define a set of color spaces and match those with a text color? It sounds tricky to me. And by using color spaces I'm not confident with that the contrast between bg and text is good enough, but maybe there's an easy way to ensure that?

@rigelk rigelk added Component: Channels UI non-trivial UI changes, that might need discussion labels Apr 23, 2021
@Chocobozzz Chocobozzz merged commit 0979075 into Chocobozzz:develop Apr 27, 2021
@kontrollanten kontrollanten deleted the feat-3935-avatar-initial-part-2 branch April 27, 2021 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Channels UI non-trivial UI changes, that might need discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User initials as default avatar
3 participants