LearnNewsExamplesServices
Frontmatter
id8754
titleImplement Theme-Aware Mermaid Diagram Rendering
stateClosed
labels
enhancementepicdesignai
assigneestobiu
createdAtJan 17, 2026, 7:08 AM
updatedAtJan 17, 2026, 11:44 AM
githubUrlhttps://github.com/neomjs/neo/issues/8754
authortobiu
commentsCount1
parentIssue8727
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 17, 2026, 11:44 AM

Implement Theme-Aware Mermaid Diagram Rendering

Closed v11.23.0 enhancementepicdesignai
tobiu
tobiu commented on Jan 17, 2026, 7:08 AM

Implement theme-aware rendering for Mermaid diagrams to ensure legibility in both Light and Dark modes.

Problem: Mermaid diagrams currently render with default (light) styling, which is illegible in Dark Mode (e.g., dark text on dark background, or harsh white backgrounds). Mermaid does not automatically adapt to CSS background changes.

Requirements:

  1. Theme Detection: The Neo.main.addon.Mermaid (Main Thread) must be aware of the current application theme.
  2. Configuration: Pass the appropriate theme config (e.g., { theme: 'dark' }) to Mermaid during initialization or execution.
  3. Re-rendering: Implement logic to re-render diagrams when the application theme switches dynamically.
  4. Markdown Integration: Ensure Neo.component.Markdown correctly propagates the theme state to the addon.
tobiu added the enhancement label on Jan 17, 2026, 7:08 AM
tobiu added the design label on Jan 17, 2026, 7:08 AM
tobiu added the ai label on Jan 17, 2026, 7:08 AM
tobiu added parent issue #8727 on Jan 17, 2026, 7:09 AM
tobiu assigned to @tobiu on Jan 17, 2026, 7:09 AM
tobiu added the epic label on Jan 17, 2026, 10:47 AM
tobiu referenced in commit 9d354e8 - "feat: Implement theme-aware Mermaid diagram rendering (#8754)" on Jan 17, 2026, 10:54 AM
tobiu
tobiu Jan 17, 2026, 10:54 AM

Input from Gemini 3 Pro:

✦ I have implemented theme-aware rendering for Mermaid diagrams.

Changes:

  1. Neo.main.addon.Mermaid:

    • Added a themeMap to map Neo themes (neo-theme-dark, etc.) to Mermaid themes (dark, neutral, etc.).
    • Added logic to render() to detect theme changes and re-initialize mermaid.js only when the mapped theme changes.
  2. Neo.component.wrapper.Mermaid:

    • Implemented afterSetTheme to trigger a re-render when the component's theme changes.
    • Updated render() to pass the current Neo theme to the addon.
  3. Neo.component.Markdown:

    • Implemented afterSetTheme to re-process the markdown content (and thus re-render Mermaid blocks) upon theme switch.
    • Updated the Mermaid rendering block to pass the current Neo theme to the addon.

Outcome: Mermaid diagrams will now automatically adapt to the application's theme, ensuring legibility in both Light and Dark modes. The mapping logic is centralized in the addon for consistency.

tobiu referenced in commit c1d5df4 - "docs: Enhance Mermaid Addon JSDoc with Knowledge Base Strategy (#8754)" on Jan 17, 2026, 11:33 AM
tobiu referenced in commit d1a4eec - "docs: Refine Markdown Component JSDoc to reflect unified lazy loading strategy (#8754)" on Jan 17, 2026, 11:41 AM
tobiu closed this issue on Jan 17, 2026, 11:44 AM