Skip to content

Extend player-based colour schemes (Fixes #14) and fix PNG generation issue (Fixes #37) #50

Closed
Manik-Khajuria-5 wants to merge 2 commits intogambitproject:mainfrom
Manik-Khajuria-5:Add-different-options-for-colouring-game-graphics-by-player
Closed

Extend player-based colour schemes (Fixes #14) and fix PNG generation issue (Fixes #37) #50
Manik-Khajuria-5 wants to merge 2 commits intogambitproject:mainfrom
Manik-Khajuria-5:Add-different-options-for-colouring-game-graphics-by-player

Conversation

@Manik-Khajuria-5
Copy link
Copy Markdown

@Manik-Khajuria-5 Manik-Khajuria-5 commented Mar 3, 2026


Summary

This PR extends the colour scheme functionality in draw_tree and also fixes a PNG generation bug identified during testing.

It now:

This contribution is submitted as part of my GSoC 2026 application (Project Idea 3: Layout algorithm for visualising game trees).


Changes

Colour Scheme Improvements (Fixes #14)

  • Improved existing "gambit" colour scheme:

    • Ensures proper scaling for multiple players.
    • Handles cases where the number of players exceeds predefined colours.
  • Added new "distinctipy" colour scheme:

    • Uses the distinctipy package to dynamically generate visually distinct colours.
    • Suitable for games with many players.
    • Improves clarity in larger game trees.
  • Updated get_player_color():

    • Added support for multiple schemes via color_scheme parameter.
    • Preserved backward compatibility (default behaviour unchanged).

PNG Generation Fix (Related to #37)

  • Fixed CLI PNG export logic.

  • Previously, PNG conversion attempted to use a temporary PDF path that was never written.

  • Updated logic to:

    • Use the actual PDF path returned by generate_pdf().
    • Ensure Ghostscript / ImageMagick operate on an existing file.
  • Verified successful PNG generation locally.


Dependencies

  • distinctipy

Testing

  • Tested locally using sample .ef files.

  • Verified correct TikZ output for:

    • Default scheme
    • "gambit" scheme
    • "distinctipy" scheme
  • Verified:

    • PDF generation works
    • PNG generation works (after fix)
    • No regression in existing functionality

Fixes #14

Default

screenshot-2026-03-03_13-51-14

Gambit

screenshot-2026-03-03_13-50-56

Distinctipy

screenshot-2026-03-03_13-52-02

Fixes [#37]


screenshot-2026-03-03_17-19-10

Closes #14


Closes #37


@Manik-Khajuria-5 Manik-Khajuria-5 changed the title Add additional colour scheme options for player-based colouring (Fixes #14) Extend player-based colour schemes (Fixes #14) and fix PNG generation issue (Fixes #37) Mar 3, 2026
@edwardchalstrey1
Copy link
Copy Markdown
Member

Hi @Manik-Khajuria-5 thanks for this. We will review this once we have received your project proposal. Thanks!

@Manik-Khajuria-5
Copy link
Copy Markdown
Author

@edwardchalstrey1 I am currently working on project proposal will try to send it as soon as possible

@edwardchalstrey1
Copy link
Copy Markdown
Member

@edwardchalstrey1 I am currently working on project proposal will try to send it as soon as possible

Thanks, but I believe there is a plenty of time (check the GSoC timeline), so no rush :)

@Manik-Khajuria-5
Copy link
Copy Markdown
Author

@edwardchalstrey1 okk got it. Thanks

@edwardchalstrey1
Copy link
Copy Markdown
Member

Thanks for this @Manik-Khajuria-5 but I'm now going to merge a different solution to the problem :)

@Manik-Khajuria-5
Copy link
Copy Markdown
Author

@edwardchalstrey1 okk got it

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.

[Bug]: PNG generation always fails on local Mac [Good first issue]: Add different options for colouring game graphics by player

2 participants