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

Fix gradient generation to reduce hue collisions for longer usernames #53

Closed
wants to merge 2 commits into from

Conversation

AntoineKM
Copy link

Hi @tobiaslins,

What did I change?

  • Improved the generateGradient function by introducing a secondary hash function to reduce hue collisions for longer usernames.
  • Kept lightness and saturation values constant, while ensuring more unique gradients by varying the hue.

Why did I change it?

  • Longer usernames were producing similar or identical gradients due to collisions in the djb2 hash function. This update enhances the uniqueness of gradients, ensuring better differentiation for longer strings without changing lightness or saturation.

Linked Issues

Close: #52

Copy link

vercel bot commented Sep 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
avatar ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 30, 2024 8:39pm

utils/gradient.ts Outdated Show resolved Hide resolved
Copy link
Member

@styfle styfle left a comment

Choose a reason for hiding this comment

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

@styfle styfle mentioned this pull request Sep 30, 2024
@styfle
Copy link
Member

styfle commented Sep 30, 2024

This should fix it: #54

@AntoineKM AntoineKM closed this Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Longer usernames break algorithm?
2 participants