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

93 lines
3.6 KiB
Plaintext

// Dark — the palette the docs have always used, restated as a theme.
//
// This exists so the .dot sources can stop carrying colour. It reproduces what
// the committed SVGs look like today, which also makes it the regression
// oracle: strip the inline colours from a source, render it through this, and
// the result should be the diagram you had before. If it is not, the strip was
// wrong.
//
// Palette matches common/theme/themes/soleprint.css, so a diagram and the page
// around it are the same visual language.
BEGIN {
string BG = "#0a0a0a";
string FILL = "#1a1a1a";
string LINE = "#333333";
string INK = "#e5e5e5";
string MUTED = "#a3a3a3";
string DIM = "#666666";
string FONT = "Helvetica";
graph_t sg;
// The soleprint amber, and the three system colours, each with the lighter
// text variant the docs use for labels on dark.
string ACC_S = "#d4a574"; string ACC_T = "#d4a574";
string ART_S = "#b91c1c"; string ART_T = "#fca5a5";
string ATL_S = "#15803d"; string ATL_T = "#86efac";
string STA_S = "#1d4ed8"; string STA_T = "#93c5fd";
}
BEG_G {
$G.bgcolor = BG;
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", "");
$G.fontname = FONT;
// The graph title takes the accent of whatever system the graph is about;
// graphs declare that with a class on the digraph itself.
if ($G.class == "artery") { $G.fontcolor = ART_T; }
else if ($G.class == "atlas") { $G.fontcolor = ATL_T; }
else if ($G.class == "station") { $G.fontcolor = STA_T; }
else { $G.fontcolor = ACC_T; }
for (sg = fstsubg($G); sg; sg = nxtsubg(sg)) {
if (index(sg.name, "cluster") == 0) {
sg.fontname = FONT;
sg.color = LINE;
sg.fontcolor = DIM;
if (sg.class == "artery") { sg.color = ART_S; sg.fontcolor = ART_T; }
else if (sg.class == "atlas") { sg.color = ATL_S; sg.fontcolor = ATL_T; }
else if (sg.class == "station") { sg.color = STA_S; sg.fontcolor = STA_T; }
else if (sg.class == "accent") { sg.color = ACC_S; sg.fontcolor = ACC_T; }
else if (sg.class == "ok") { sg.color = ATL_S; sg.fontcolor = ATL_T; }
if (index(sg.style, "dashed") < 0) { sg.style = "dashed"; }
}
}
}
N {
if (index($.style, "invis") >= 0) { continue; }
$.fontname = FONT;
$.fontcolor = INK;
$.color = LINE;
$.fillcolor = FILL;
if ($.class == "accent") { $.color = ACC_S; }
else if ($.class == "artery") { $.color = ART_S; }
else if ($.class == "atlas") { $.color = ATL_S; }
else if ($.class == "station") { $.color = STA_S; }
else if ($.class == "accent-text") { $.fontcolor = ACC_T; }
else if ($.class == "ok") { $.fontcolor = ATL_T; }
else if ($.class == "muted") { $.fontcolor = MUTED; }
if (index($.style, "dashed") >= 0) { $.style = "filled,dashed"; }
else { $.style = "filled"; }
}
E {
$.fontname = FONT;
$.fontcolor = MUTED;
$.color = DIM;
if ($.class == "accent") { $.color = ACC_S; $.fontcolor = ACC_T; }
else if ($.class == "artery") { $.color = ART_S; $.fontcolor = ART_T; }
else if ($.class == "atlas") { $.color = ATL_S; $.fontcolor = ATL_T; }
else if ($.class == "station") { $.color = STA_S; $.fontcolor = STA_T; }
}