Files
soleprint/docs/graphs/themes/lucid.gvpr
2026-08-10 09:19:19 -03:00

115 lines
4.7 KiB
Plaintext

// Lucid — graphviz output shaped after a lucid.app export.
//
// Run through gvpr, not as .dot attributes, because gvpr rewrites the parsed
// graph: it wins over whatever the source set inline, so one .dot renders in
// any theme without being edited. See render.sh.
//
// The look, and why each part is what it is:
// white canvas this ends up in a document and gets printed
// rounded box, hairline Lucid's default shape is a rounded rect with a grey
// 1px stroke, not a coloured fill
// pale-blue accent #d6e4ff on #3a7dff is Lucid's own selected-shape pair
// Arial the one face guaranteed on Windows, and aliased to
// Liberation Sans by fontconfig on Linux — so the SVG
// measures the same on both and the text does not
// reflow out of its box
//
// Structure is preserved, only palette is replaced. Two styles carry meaning
// rather than decoration and are explicitly kept: `invis` (a layout spacer —
// overwriting it makes hidden scaffolding visible) and `dashed` (a weaker
// relationship). Shapes are never touched: a cylinder is a datastore.
BEGIN {
string BG = "#ffffff";
string INK = "#1f2933";
string MUTED = "#616e7c";
string LINE = "#9aa5b1";
string SOFT = "#cbd2d9";
string FONT = "Arial";
graph_t sg;
string FILL = "#ffffff";
string FILL_ALT = "#f5f7fa";
// class -> (stroke, fill). Lucid's palette for emphasised shapes.
string ACC_S = "#3a7dff"; string ACC_F = "#d6e4ff";
string ART_S = "#c0392b"; string ART_F = "#fdeaea";
string ATL_S = "#1a7f45"; string ATL_F = "#e6f5ec";
string STA_S = "#2b5fd9"; string STA_F = "#e8effd";
}
BEG_G {
$G.bgcolor = BG;
$G.fontname = FONT;
$G.fontcolor = INK;
// Defaults for anything the per-node block does not reach.
setDflt($G, "N", "fontname", FONT);
setDflt($G, "E", "fontname", FONT);
// Declare `class` so reading it on an untagged object is defined
// rather than a warning — most nodes carry no class by design.
setDflt($G, "G", "class", "");
setDflt($G, "N", "class", "");
setDflt($G, "E", "class", "");
// Clusters: a pale container, the way Lucid draws a grouping box.
for (sg = fstsubg($G); sg; sg = nxtsubg(sg)) {
if (index(sg.name, "cluster") == 0) {
sg.fontname = FONT;
sg.color = SOFT;
sg.fontcolor = MUTED;
sg.bgcolor = FILL_ALT;
// A tagged container keeps its identity, the way a Lucid swimlane
// is tinted by what it holds.
if (sg.class == "artery") { sg.color = ART_S; sg.bgcolor = ART_F; }
else if (sg.class == "atlas") { sg.color = ATL_S; sg.bgcolor = ATL_F; }
else if (sg.class == "station") { sg.color = STA_S; sg.bgcolor = STA_F; }
else if (sg.class == "accent") { sg.color = ACC_S; sg.bgcolor = ACC_F; }
// Keep dashed where the source chose it; it reads as "logical
// grouping" rather than "deployed boundary".
if (index(sg.style, "dashed") < 0) { sg.style = "rounded"; }
else { sg.style = "dashed,rounded"; }
}
}
}
N {
// An invisible node is layout scaffolding. Filling it would draw it.
if (index($.style, "invis") >= 0) { continue; }
$.fontname = FONT;
$.fontcolor = INK;
$.color = LINE;
$.fillcolor = FILL;
$.penwidth = 1;
if ($.class == "accent") { $.color = ACC_S; $.fillcolor = ACC_F; }
else if ($.class == "artery") { $.color = ART_S; $.fillcolor = ART_F; }
else if ($.class == "atlas") { $.color = ATL_S; $.fillcolor = ATL_F; }
else if ($.class == "station") { $.color = STA_S; $.fillcolor = STA_F; }
else if ($.class == "accent-text") { $.fontcolor = ACC_S; }
else if ($.class == "ok") { $.color = ATL_S; $.fillcolor = ATL_F; }
else if ($.class == "muted") { $.fillcolor = FILL_ALT; $.fontcolor = MUTED; }
// `record` ignores rounding, and plaintext has no box to round.
if ($.shape == "record" || $.shape == "Mrecord" || $.shape == "plaintext") {
$.style = "filled";
} else if (index($.style, "dashed") >= 0) {
$.style = "filled,rounded,dashed";
} else {
$.style = "filled,rounded";
}
}
E {
$.fontname = FONT;
$.fontcolor = MUTED;
$.color = LINE;
$.arrowsize = 0.7;
if ($.class == "accent") { $.color = ACC_S; $.fontcolor = ACC_S; }
else if ($.class == "artery") { $.color = ART_S; $.fontcolor = ART_S; }
else if ($.class == "atlas") { $.color = ATL_S; $.fontcolor = ATL_S; }
else if ($.class == "station") { $.color = STA_S; $.fontcolor = STA_S; }
}