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 country colors for graphs and maps; avoid duplicates #117

Merged
merged 2 commits into from
Nov 12, 2023

Conversation

MichaelMakesGames
Copy link
Collaborator

Closes #80

A few notes:

  • This tries to avoid duplicates by darkening/lighting colors (shifting the v in hsv)
    • The actual resolved color of a country can change depending on what other countries exist in the DB, so game_id needs to passed in to get_color_vals
    • Country colors for a given game_id are cached. If any countries are created, the cache is cleared
  • This tries to avoid grayscale colors by using the secondary color if the primary color has low saturation
  • A minimum v is enforced for readability
  • I needed to enhance the rust parser to understand the color value syntax (eg rgb { 1 2 3 }, hsv { 0.1 0.2 0.3 })

Copy link
Owner

@eliasdoehne eliasdoehne left a comment

Choose a reason for hiding this comment

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

Nice! Great that the parser works on the game files too with these adjustments, I never tried that 👍

@eliasdoehne eliasdoehne merged commit 00b4f03 into eliasdoehne:master Nov 12, 2023
3 checks passed
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.

Add graph/timeline colors based on country flags
2 participants