feat: implement dynamic distinctipy and colorblind-friendly schemes (#14)#52
Closed
XinkeLi-UChicago wants to merge 3 commits intogambitproject:mainfrom
Closed
feat: implement dynamic distinctipy and colorblind-friendly schemes (#14)#52XinkeLi-UChicago wants to merge 3 commits intogambitproject:mainfrom
XinkeLi-UChicago wants to merge 3 commits intogambitproject:mainfrom
Conversation
Member
|
Thanks for this @XinkeLi-UChicago - we've received your email regarding the project proposal and looking into a different project idea - give us a bit of time to respond properly and I will review this PR once we've got that sorted. Thanks! |
Contributor
Author
|
Thanks @edwardchalstrey1! Just a heads-up: the earlier CI failures were due to an edge case with unassigned nodes (player < 0). I've pushed a fix in my latest commit. |
Member
|
Thanks for this @XinkeLi-UChicago - I'm going to close this PR but I will be accepting the changes via #58 |
Contributor
Author
|
Thanks for letting me know @edwardchalstrey1! Glad the changes were useful. Happy to help with anything else. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #14
Description
This PR implements the requested enhancements for game tree coloring, including a dynamic high-contrast scheme and an accessibility-focused option:
get_player_color. If a game exceeds 6 players, it now raises a descriptiveValueErrorrecommending the new dynamic schemes, replacing the silent fallback to black with an explicit error.distinctipylibrary. It dynamically generates high-contrast, deterministic colors (via a fixedrngseed) for an arbitrary number of players. The chance node color and background colors are explicitly excluded from generation to ensure visual clarity.colorblindscheme leveragingdistinctipy's built-in Deuteranomaly simulation. This allows game trees to be easily interpreted by individuals with the most common form of color vision deficiency.Changes
src/draw_tree/core.py: Modifiedget_player_color,color_definitions, andgenerate_tikzto support dynamic player counting and multiple color schemes.pyproject.toml: Addeddistinctipyto the runtime dependencies.Implementation Notes
Gameobject or the.effile..effiles using inline player definitions, the scanner safely falls back to generating 6 distinct colors to guarantee rendering stability.How to test