Skip to content

feat: add interactive theme system with 11 pre-built color themes#42

Open
turkycat wants to merge 1 commit into
nicobailon:mainfrom
turkycat:main
Open

feat: add interactive theme system with 11 pre-built color themes#42
turkycat wants to merge 1 commit into
nicobailon:mainfrom
turkycat:main

Conversation

@turkycat
Copy link
Copy Markdown

@turkycat turkycat commented Apr 15, 2026

Summary

Adds a runtime theme switching system to visual-explainer:

  • 11 pre-built color themes — Dracula, Nord, One Dark, Catppuccin Mocha/Latte, Tokyo Night, Gruvbox Dark/Light, Synthwave '84, Solarized Light, GitHub Light
  • Interactive theme picker — fixed row of colored circle buttons that swap CSS custom properties on <html> and re-render Mermaid diagrams live
  • Font pair picker — 6 switchable font combinations (Outfit/Cascadia Code, Space Grotesk/Fira Code, IBM Plex, Fraunces/JetBrains Mono, DM Sans/DM Mono, Syne/JetBrains Mono)
  • Static config override.claude/visual-explainer.local.md theme field sets the default selection
  • Theme files use the same CSS custom property names as existing patterns, so all existing CSS patterns work unchanged

What's included

Component Files
Theme definitions (11) plugins/visual-explainer/themes/*.md
Theme picker + font picker spec plugins/visual-explainer/SKILL.md (additive sections)
Theme config note plugins/visual-explainer/references/css-patterns.md
Theme documentation README.md
Quality check Added "Theme picker present" to Quality Checks

How it works

Each theme file defines CSS custom properties and Mermaid themeVariables in a structured markdown format. The SKILL.md instructs the agent to:

  1. Read all 11 theme files from ./themes/ to extract CSS variable values
  2. Embed a themes JS object and applyTheme() function in every generated page
  3. Place a row of colored dot buttons in a fixed header bar
  4. On click, swap all CSS custom properties and re-render Mermaid diagrams with matching themeVariables

The font pair picker works similarly, swapping --font-sans and --font-mono CSS variables and re-rendering Mermaid with the new fontFamily.

Screenshots

Screenshots show the same demo page (3 Mermaid sequence diagrams with callouts) under different theme + font combinations:

Nord + IBM Plex Sans (default)

01-nord-ibm-plex

Dracula + Fraunces

02-dracula-fraunces

GitHub Light + Space Grotesk

03-github-light-space-grotesk

Synthwave '84 + Syne

04-synthwave-syne

Design decisions

  • Runtime switching, not static — The upstream approach of picking one palette at design time is preserved as a fallback, but users can now explore themes interactively on any page
  • Additive, not destructive — All existing SKILL.md content, commands, templates, and references are untouched. Theme sections are inserted between the aesthetic direction and structure sections
  • Same CSS variable names — Themes use the exact same --bg, --surface, --accent, etc. variable names that css-patterns.md already defines, so all existing patterns work without modification
  • data-source pattern — Mermaid re-rendering reads from el.dataset.source (saved before first render) to avoid the "SVG text ≠ diagram source" bug

Port the turkycat fork's theme system (11 pre-built color themes,
interactive theme picker, font pair picker) onto upstream v0.6.3
which added slide decks, multi-diagram zoom/pan, anti-slop guardrails,
class/C4 diagrams, share-to-Vercel, and plugin marketplace structure.

Theme files moved into plugins/visual-explainer/themes/ to match
upstream's plugin directory layout. Theme picker and font pair picker
sections added to SKILL.md. Theme config note added to css-patterns.md.
README updated with theme documentation.

Backup of pre-rebase turkycat/main at origin/main-backup-2026-04-14.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant