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 consistent colors for users in project/volume charts #888

Merged
merged 8 commits into from
Jul 26, 2024

Conversation

dlangenk
Copy link
Member

This way the colors are consistent fixes #497

@dlangenk dlangenk requested a review from mzur July 23, 2024 12:50
Copy link
Member

@mzur mzur left a comment

Choose a reason for hiding this comment

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

I'm not sure if adding the whole md5 algorithm is worth it here. Also this could randomly produce very dark colors, right? What about reusing the random color function of new labels and then generating a map wit colors for each user on the fly? The only downside would be that colors of users are different between page loads...

So if we want consistent colors between page loads, md5 may be a valid option. But then I'd like to at least change it so the user ID is used for hashing instead of the name and the random label color function is used to get a bright color. The function could even be adapted to accept an optional seed.

@dlangenk
Copy link
Member Author

What about this one? It uses a much simpler hashing. And it uses HSL color space to have fixed saturation and lightness to produce bright results. However, users with similar colors might occur. Using the id instead of name is not that simple as the information is not available at that point (yet). But I don't see a problem with name.
If we don't want to use a fixed user => color mapping we could just have a list of colors and use that.

@dlangenk dlangenk requested a review from mzur July 24, 2024 14:55
@mzur mzur changed the title Generate colors from username using md5 hash. Use consistent colors for users in project/volume charts Jul 25, 2024
Copy link
Member

@mzur mzur left a comment

Choose a reason for hiding this comment

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

The user IDs are available but it might be a little complicated to get them where you need them. While I'd still prefer the IDs over the user names, I'm ok with the names for now, as they will work in most cases. We can open a follow-up issue to use the IDs at some point.

@dlangenk dlangenk requested a review from mzur July 25, 2024 20:40
Copy link
Member

@mzur mzur left a comment

Choose a reason for hiding this comment

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

Looks good! I increased the minimum lightness a bit because some colors were too dark for my taste. I only have one question (below) then it can be merged.

mzur
mzur previously approved these changes Jul 26, 2024
@mzur
Copy link
Member

mzur commented Jul 26, 2024

One thing I now noticed is that if the users did not annotate in consecutive months, the x-axis is not "to scale", if you know what I mean. Do we think this as a bug or a feature? 😄

@dlangenk
Copy link
Member Author

For now it's a feature but I guess it's rather a bug ;-)

@mzur
Copy link
Member

mzur commented Jul 26, 2024

Ok then I'll create a follow-up issue.

@mzur mzur merged commit 0a41139 into master Jul 26, 2024
6 checks passed
@mzur mzur deleted the commonUserColorsCharts branch July 26, 2024 08:14
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.

Use consistent colors for users in project/volume charts
2 participants