Improving Software Engineering Quality: Fixing Illegible Mermaid Diagrams in GitHub Dark Mode

GitHub's Dark Mode has become a staple for many developers, offering a visually comfortable environment for extended coding and review sessions. However, a recent discussion in the GitHub Community has brought to light a significant accessibility and usability concern: the illegibility of Mermaid diagram previews in this popular theme. This issue directly impacts the ease of documentation and code understanding, touching upon core aspects of software engineering quality.

Developer struggling to read a low-contrast Mermaid diagram in GitHub Dark Mode.
Developer struggling to read a low-contrast Mermaid diagram in GitHub Dark Mode.

The Challenge: Illegible Mermaid Diagrams in Dark Mode

The problem was initially reported by user sfriedman-cape, who observed that Mermaid .mmd file previews, particularly for sequence diagrams, become nearly unreadable in Dark Mode. The specific complaint centered on actions within the diagram being rendered as gray text against a black background, creating an extremely low-contrast visual that is difficult to decipher.

Consider this example Mermaid sequence diagram:

sequenceDiagram
    autonumber
    participant Bob
    participant Alice
    participant Tim
    Bob->>Bob: Bob takes Action A
    Bob->>Bob: Bob takes Action B
    Bob->>Alice: Give a key to Alice
    Alice->>Bob: Return a response back to Bob
    Bob->>Tim: Give a key to Tim
    Tim->>Bob: Success

When rendered in Dark Mode, the critical action descriptions like "Bob takes Action A" or "Give a key to Alice" appear with insufficient contrast, making quick comprehension impossible. This isn't merely a cosmetic flaw; it's a functional impediment that slows down reviews and diminishes the utility of visual documentation.

Developers collaborating effectively with a clear, high-contrast Mermaid diagram.
Developers collaborating effectively with a clear, high-contrast Mermaid diagram.

Impact on Developer Productivity and Accessibility

The core of this issue lies in accessibility. As KhyFee eloquently put it, this is "an accessibility / dark-mode contrast issue, not only cosmetics." Low contrast text fails basic accessibility guidelines, making it challenging for all users, and particularly those with visual impairments, to engage with the content effectively. For teams relying on Mermaid diagrams for clear communication of system flows and interactions, this visual barrier can hinder collaborative git development and impact the overall software engineering quality of projects.

When developers cannot easily read diagrams directly within their GitHub workflow, they are forced to seek workarounds, which adds friction and reduces productivity. This can lead to less frequent updates of diagrams or a reluctance to use them, undermining the very purpose of visual documentation.

Community Engagement and Potential Solutions

GitHub's product teams have acknowledged the feedback, with an automated response confirming submission and a direct follow-up from queenofcorgis requesting more details (operating system, browser, version, and screenshots). This engagement is a positive sign that the issue is being investigated.

The community has also offered insightful suggestions for resolution:

  • Dark-Aware Theming: Implement specific Mermaid theme tokens that are designed to provide appropriate contrast within a dark environment.
  • Forced Light Canvas: Alternatively, the renderer could force a light background for the diagram canvas itself, regardless of the surrounding GitHub theme, ensuring dark text on a light background for optimal readability.

As a temporary workaround, users can export their Mermaid diagrams as SVG or PNG files with an explicit light theme for critical diagrams. However, this adds an extra step and doesn't solve the native preview problem for reviewers who prefer Dark Mode.

Enhancing Software Engineering Quality Through Better Tools

This discussion highlights the continuous need for platforms like GitHub to ensure their tools are not only powerful but also accessible and user-friendly across all configurations. Addressing issues like the Mermaid Dark Mode contrast problem is crucial for maintaining high standards of software engineering quality and fostering an inclusive development environment. Feedback from the community is invaluable in identifying these pain points and driving improvements that benefit everyone, from individual contributors to large engineering teams.

By resolving such visual inconsistencies, GitHub can further solidify its position as a robust platform for collaborative git development, ensuring that documentation remains a clear and integral part of the development lifecycle, without needing to seek a Waydev free alternative for diagramming tools.

|

Dashboards, alerts, and review-ready summaries built on your GitHub activity.

 Install GitHub App to Start
Dashboard with engineering activity trends