aamanlamba Claude commited on
Commit
96007fc
·
1 Parent(s): eaacb3b

Improve Mermaid diagram styling - smaller, more compact nodes

Browse files

- Add Mermaid init config for smaller 12px font and cleaner theme
- Use rounded corners (rx:5, ry:5) for all node types
- Add subtle colored borders matching node type colors
- Thinner 1px stroke width for cleaner appearance

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +15 -12
app.py CHANGED
@@ -230,7 +230,10 @@ def generate_mermaid_from_graph(graph: LineageGraph) -> str:
230
  if not graph.nodes:
231
  return "graph TD\n A[No data to display]"
232
 
233
- lines = ["graph TD"]
 
 
 
234
 
235
  # Group nodes by category for subgraphs
236
  categories = {}
@@ -240,18 +243,18 @@ def generate_mermaid_from_graph(graph: LineageGraph) -> str:
240
  categories[cat] = []
241
  categories[cat].append(node)
242
 
243
- # Generate nodes with styling
244
  node_styles = {
245
- "source": "fill:#e1f5fe",
246
- "external_api": "fill:#e1f5fe",
247
- "table": "fill:#e8f5e9",
248
- "view": "fill:#f3e5f5",
249
- "model": "fill:#fff3e0",
250
- "report": "fill:#fce4ec",
251
- "dimension": "fill:#e0f7fa",
252
- "fact": "fill:#fff8e1",
253
- "destination": "fill:#ffebee",
254
- "task": "fill:#f5f5f5"
255
  }
256
 
257
  # Add subgraphs for categories
 
230
  if not graph.nodes:
231
  return "graph TD\n A[No data to display]"
232
 
233
+ lines = [
234
+ "%%{init: {'theme': 'base', 'themeVariables': {'fontSize': '12px', 'fontFamily': 'arial', 'primaryColor': '#e8f5e9', 'primaryBorderColor': '#4caf50', 'lineColor': '#666'}}}%%",
235
+ "graph TD"
236
+ ]
237
 
238
  # Group nodes by category for subgraphs
239
  categories = {}
 
243
  categories[cat] = []
244
  categories[cat].append(node)
245
 
246
+ # Generate nodes with styling - compact with rounded corners and subtle borders
247
  node_styles = {
248
+ "source": "fill:#e3f2fd,stroke:#1976d2,stroke-width:1px,rx:5,ry:5",
249
+ "external_api": "fill:#e3f2fd,stroke:#1976d2,stroke-width:1px,rx:5,ry:5",
250
+ "table": "fill:#e8f5e9,stroke:#388e3c,stroke-width:1px,rx:5,ry:5",
251
+ "view": "fill:#f3e5f5,stroke:#7b1fa2,stroke-width:1px,rx:5,ry:5",
252
+ "model": "fill:#fff3e0,stroke:#f57c00,stroke-width:1px,rx:5,ry:5",
253
+ "report": "fill:#fce4ec,stroke:#c2185b,stroke-width:1px,rx:5,ry:5",
254
+ "dimension": "fill:#e0f7fa,stroke:#0097a7,stroke-width:1px,rx:5,ry:5",
255
+ "fact": "fill:#fff8e1,stroke:#ffa000,stroke-width:1px,rx:5,ry:5",
256
+ "destination": "fill:#ffebee,stroke:#d32f2f,stroke-width:1px,rx:5,ry:5",
257
+ "task": "fill:#fafafa,stroke:#616161,stroke-width:1px,rx:5,ry:5"
258
  }
259
 
260
  # Add subgraphs for categories