Skip to content

Add a theme gallery rendered headlessly from every registered theme - #135

Merged
matt-edmondson merged 2 commits into
mainfrom
claude/project-thread-4d94d3
Oct 9, 2026
Merged

matt-edmondson merged 2 commits into
mainfrom
claude/project-thread-4d94d3

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Requested by Matt · project thread

Before: The only way to see what a theme looks like was to run ThemeProvider.Demo on a desktop.

After: docs/gallery/ will hold 39 pictures and a captioned README.md, kept current from main:

  • overview.png: all 38 themes on one page. Each row is drawn in that theme's background colour, with its name in its text colour, its neutral ramp, and one chip per accent meaning.
  • One picture per ThemeRegistry.AllThemes entry, named by slug (catppuccin-mocha.png, gruvbox-light.png, vscode-light.png, …). Each is a 760x448 sample window themed through ImGuiPaletteMapper. It contains:
    • a title bar
    • tabs
    • buttons, checkboxes and radio buttons
    • a slider, a text input, a combo and a progress bar
    • a collapsing header over a bordered table with alternating rows
    • semantic status text
    • the full semantic palette: 11 meanings × 7 priorities

A theme added to the registry gets a picture automatically. EveryThemeHasAPicture checks this.

This PR commits no PNGs and no docs/gallery/README.md. They arrive on the first push to main after this merges, or when the Theme Gallery workflow is dispatched on main. The README gains one line that links to the gallery index.

How:

  • New tests/ThemeProvider.UITests project. It is MSTest under ImGuiAppHarness and has been added to the solution. ktsu.ImGui.App.Testing 3.64.1 is added to Directory.Packages.props. The project lives under tests/*.UITests/, so the shared pipeline runs it on Linux only.
  • How the pictures are drawn:
    • Each picture starts its own harness. The display is exactly the picture's size, the mouse is parked off-screen, and ImGuiApp's Nerd Font is loaded.
    • Every value is a constant, so the output is byte-identical from run to run.
    • Pictures go to a temporary directory, deleted on cleanup, unless THEMEPROVIDER_GALLERY_OUT names one.
    • The demo's drawing is private to its WinExe, so the sample window is drawn in the test. The demo is not refactored.
  • New .github/workflows/theme-gallery.yml, modelled on ImGuiApp's widget-gallery.yml.
    • It is triggered only by workflow_call and workflow_dispatch, never workflow_run.
    • It is guarded to ktsu-dev/ThemeProvider on main.
    • It regenerates the gallery and stages only docs/gallery, refusing any PNG that is not an LFS pointer.
    • It commits as github-actions[bot] with the message [bot][skip ci] Regenerate the theme gallery, then pushes with a rebase-and-retry loop.
  • ci.yml calls it in a theme-gallery job that needs ci, only on a push to main.
  • Pushing requires github-actions[bot] to be allowed to bypass main's ruleset, as it is in ImGuiApp.

Verified:

  • The whole solution builds in Release with warnings as errors.
  • ThemeProvider.Test: 77/77 passed.
  • ThemeProvider.UITests: 41/41 passed.
  • The gallery was generated twice into separate directories, and all 40 files were byte-identical (cmp).

🤖 Generated with Claude Code

https://claude.ai/code/session_01WWRBkw7bXdWGzuLpqnCvrB


Generated by Claude Code

Adds tests/ThemeProvider.UITests, which draws a fixed sample window for each
ThemeRegistry entry through ImGuiPaletteMapper under ImGuiAppHarness, plus an
overview of all themes, and writes the PNGs and a captioned README.md to a
temporary directory, or to THEMEPROVIDER_GALLERY_OUT when set.

The theme-gallery workflow runs those tests on main after CI passes and
commits docs/gallery back as LFS objects when the pictures change. It is a
called workflow plus workflow_dispatch, never workflow_run.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WWRBkw7bXdWGzuLpqnCvrB
@matt-edmondson matt-edmondson self-assigned this Oct 9, 2026
Comment thread tests/ThemeProvider.UITests/Gallery/ThemeGallery.cs Fixed
Comment thread tests/ThemeProvider.UITests/Gallery/ThemeGallery.cs Fixed
Comment thread tests/ThemeProvider.UITests/Gallery/ThemeGallery.cs Fixed
Path.Join keeps the output directory even if a later segment is rooted.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WWRBkw7bXdWGzuLpqnCvrB
@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit ee6f94c into main Oct 9, 2026
15 checks passed
@matt-edmondson
matt-edmondson deleted the claude/project-thread-4d94d3 branch October 9, 2026 21:52
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.

2 participants