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

Automate country color generation #81

Open
ivan-aksamentov opened this issue Feb 2, 2021 · 1 comment
Open

Automate country color generation #81

ivan-aksamentov opened this issue Feb 2, 2021 · 1 comment
Labels
enhancement New feature or request scope: scripts Related to scripts

Comments

@ivan-aksamentov
Copy link
Collaborator

ivan-aksamentov commented Feb 2, 2021

We could make a variety of colors by generating them automatically, given country names. There are packages which allow to "hash" strings into colors, producing an (almost) unique color given a string, for example
https://pypi.org/project/colorhash/

Color hashes are stable, that is, they produce the same color if given the same string.

This can produce broader variety. But also does not guarantee that colors will be easily distinguishable from each other. We might tweak them individually, by adding a "tint" to a given country, or by adding a common "salt" or an individual "pepper" to the hashed string, or by combining all.

Individual tint:

color = ColorHash('France')
color = add_tint(color, countries['France].tint)

Common salt:

color_fr = ColorHash('France' + salt)
color_de = ColorHash('Germany' + salt)

Individual pepper:

color_fr = ColorHash('France' + countries['France].pepper)
color_de = ColorHash('Germany' + countries['Germany].pepper)

Related: #80

@ivan-aksamentov ivan-aksamentov added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Feb 2, 2021
ivan-aksamentov added a commit that referenced this issue Feb 8, 2021
Resolves #80

This replaces colored circles with short colored dashed lines as icons for country entries in plot tooltips and in filtering sidebar on "per variant" page. This way the countries with the same color look distinct if they have different line styles. The colors and styles mimic those in the plot.

The issue of duplicated colors still persists on "per cluster" page, which still uses circles. Using dashed lines there makes less sense, as there are not line plots on that page. Let's discuss this issue separately.

Additionally, some colors were too pale even when circles were used. And now with lines, especially dashed, these elements are almost indistinguishable from the background. This is poor user experience, especially in terms of accessibility.

Related: #81
@emmahodcroft
Copy link
Collaborator

I like this idea as a long-term solution!

@AdvancedCodingMonkey AdvancedCodingMonkey added scope: scripts Related to scripts and removed help wanted Extra attention is needed good first issue Good for newcomers labels Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request scope: scripts Related to scripts
Projects
None yet
Development

No branches or pull requests

3 participants