Skip to content

Fix Mermaid dark-mode contrast and add auto-remediation for diagram colors - #2921

Merged
Ancairon merged 1 commit into
masterfrom
fix/mermaid-dark-mode-contrast
Jul 13, 2026
Merged

Fix Mermaid dark-mode contrast and add auto-remediation for diagram colors#2921
Ancairon merged 1 commit into
masterfrom
fix/mermaid-dark-mode-contrast

Conversation

@Ancairon

Copy link
Copy Markdown
Member

Summary

  • Remove the blanket dark-mode CSS override that forced near-black text onto Mermaid nodes, which was hiding labels on diagrams with no custom classDef/style (e.g. the receiver pipeline diagram on the SNMP traps metrics page) since Mermaid's own dark theme already renders correct-contrast text for those.
  • Diagrams that already declare explicit classDef/style colors are unaffected — they set their own text color already.
  • Add a contrast check to ingest/ingest.py, reusing its existing WCAG luminance/contrast helpers (used today for integration logo contrast), that scans all docs for Mermaid classDef/style fill+color pairs and auto-rewrites any pair below 4.5:1 (WCAG AA normal text) to a safe default colorway. Runs as part of the existing ingest flow, so any fix flows through the existing auto-PR process — no new CI infrastructure needed.

Test plan

  • Run npm run start and confirm the receiver pipeline diagram (/docs/network-performance-monitoring/snmp-traps/metrics#receiver-pipeline) renders legible text in dark mode
  • Confirm the same diagram is unchanged in light mode
  • Spot-check a few classDef-styled diagrams (e.g. Netdata Agent, Netdata Parents pages) in both themes for no regression
  • Ran the new contrast check against the full docs/ tree locally: 203 existing color pairs scanned, 0 flagged/changed
  • Verified against a deliberately bad fixture that the auto-rewrite triggers and logs correctly

…colors

Remove the blanket dark-mode text-color override in custom.css that was
forcing near-black text onto unstyled Mermaid diagrams, hiding labels
that Mermaid's own dark theme already renders with correct contrast
(e.g. the SNMP traps receiver pipeline diagram). Diagrams with explicit
classDef/style colors are unaffected since they already declare their
own text color.

Add a contrast check to ingest.py, reusing its existing WCAG helpers
from the logo-contrast analysis, that scans classDef/style fill+color
pairs across all docs and auto-rewrites any pair below 4.5:1 (WCAG AA)
to a safe default colorway.
@netlify

netlify Bot commented Jul 13, 2026

Copy link
Copy Markdown

Deploy Preview for netdata-docusaurus ready!

Name Link
🔨 Latest commit 987a937
🔍 Latest deploy log https://app.netlify.com/projects/netdata-docusaurus/deploys/6a5490c0ec4f500008a4e904
😎 Deploy Preview https://deploy-preview-2921--netdata-docusaurus.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Ancairon
Ancairon merged commit cf4318b into master Jul 13, 2026
6 checks passed
@Ancairon
Ancairon deleted the fix/mermaid-dark-mode-contrast branch July 13, 2026 07:35
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