Fix Mermaid dark-mode contrast and add auto-remediation for diagram colors - #2921
Merged
Conversation
…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.
✅ Deploy Preview for netdata-docusaurus ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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.classDef/stylecolors are unaffected — they set their own text color already.ingest/ingest.py, reusing its existing WCAG luminance/contrast helpers (used today for integration logo contrast), that scans all docs for MermaidclassDef/stylefill+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
npm run startand confirm the receiver pipeline diagram (/docs/network-performance-monitoring/snmp-traps/metrics#receiver-pipeline) renders legible text in dark modeclassDef-styled diagrams (e.g. Netdata Agent, Netdata Parents pages) in both themes for no regressiondocs/tree locally: 203 existing color pairs scanned, 0 flagged/changed