Repository navigation
feat(mermaid): color diagram nodes with theme palette - #64
Merged
Merged
Conversation
Each innermost box (border and label) takes the next node hue, keyed by label so a repeated node keeps its hue. Lines, arrowheads, and loose text color by role; subgraph frames paint as lines. Runs concatenate back to the diagram text, so search and match highlighting are unchanged.
Startup benchmark (
|
| build | mean | ratio | verdict |
|---|---|---|---|
| baseline (main@8b38c47) | 287.1ms ± 5.4ms | — | |
| PR | 295.6ms ± 5.6ms | 1.03× | ✅ ok |
Thresholds: warn ≥ 1.1×, fail ≥ 1.25×. Baseline built from main.
First-frame (large.md, runs=10)
| metric | baseline (main@8b38c47) | PR | ratio | verdict |
|---|---|---|---|---|
| first-frame | 205.3ms | 206.7ms | 1.01× | ✅ ok |
Thresholds: warn ≥ 1.1×, fail ≥ 1.25×. Baseline built from main.
Scroll (large.md)
| metric | baseline (main@8b38c47) | PR | ratio | verdict |
|---|---|---|---|---|
| full_mount | 7718.0ms | 7124.0ms | 0.92× | ✅ ok |
| step_p50 | 23.9ms | 25.8ms | 1.08× | ✅ ok |
| step_search_p50 | 28.5ms | 26.8ms | 0.94× | ✅ ok |
| stepMatch_p50 | 21.6ms | 22.3ms | 1.03× | ✅ ok |
| commit | 126.4ms | 132.9ms | 1.05× | ✅ ok |
Thresholds: warn ≥ 1.1×, fail ≥ 1.25×. Baseline built from main.
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.
Mermaid and DOT diagrams now render in color. Each node box takes its own hue from the theme palette. Edges, arrowheads, and edge labels take a color by role.
src/app/ ├── components/blocks/ │ └── CodeBlock.tsx # renders diagram text as colored runs ├── lib/ +│ └── diagram-paint.ts # assigns a color to each diagram glyph └── styles/ └── theme.ts # adds diagram palette tokensChanges
paintDiagramscans the rendered glyph grid for box rectangles. Each innermost box (border and label) takes the next node hue.diagramNodes,diagramLine,diagramArrow, anddiagramTextreuse existing theme values.CodeBlockrenders one span per run. Each span wraps aHighlightedTextpiece.left of,over X,over X,Y).beautiful-mermaiddrops state-diagram notes.Design Decisions
beautiful-mermaidreleases can emit ANSI color. The Projection (the printed text that search and highlighting index) cannot hold escape codes, so library color is not usable here. The painted runs concatenate back to the diagram text.┬ ┴ ├ ┤) on a box border take the node hue. A terminal cell holds one color. A line-colored join would put a notch in the border. The cost is a half-cell colored stub where an edge leaves a node.Overall Flow
References / Links
🤖 Written with AI