Declarative Theme Engine (theme)
Schema-driven 4-layer selector cascade, key-wise deep merges, canonical facets, and strict isolation from spatial layout.
The theme { ... } block is Dhi’s fourth pillar. Every rule ends with a semicolon (;) and uses attribute bags—never spatial geometry keys like gap, align, dock, or min_width (E256).
Four-Pillar Isolation & Addressing
4-Layer Specificity Cascade
| Tier | Selector Form | Example |
|---|---|---|
| 1. Global Kind | <entity_kw>: [...]; / edge: [...]; | node: [border: [radius: 8]]; |
| 2. Kind + Modifier | <entity_kw> <mod>: [...]; / edge <mod>: [...]; | control decision: [fill: "#f9e2af"]; |
| 3. Schema Type | type <Type>: [...]; | type TelemetryFrame: [border: #38bdf8]; |
| 4. Individual @Id | <entity_kw> @<id>: [...]; / edge @<arrowId>: [...]; | edge @loginReq: [stroke: [color: #22c55e, width: 2]]; |
Canonical Entity & Edge Facets
Key-wise deep merge and reusable theme tokens
theme {
let CARD_BORDER = [color: "#89b4fa", radius: 8];
frame partition: [header: [fill: "#1e1e2e", color: "#cdd6f4"], border: [color: "#313244"]];
action: [fill: "#181825", border: CARD_BORDER];
control decision: [fill: "#f9e2af", border: [color: "#fab387"]];
edge reply: [stroke: [dash: dashed, width: 1.5]];
}