Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS Stylesheets in Graphviz

Tags:

css

graphviz

Graphviz supports CSS stylesheets for SVG ouptut. There's an attribute stylesheet in the documentation.

Should the attribute stylesheet be given separately to all the nodes? How can I set a stylesheet for all the graph elements just writing the CSS filename to one place only? Where?

like image 218
haba713 Avatar asked Oct 11 '25 10:10

haba713


1 Answers

The attribute stylesheet is given to a graph definition. See the sample below.

sample.dot

graph sample {
    stylesheet="sample.css"
    a [class="sky"]
    b [class="ground"]
    a -- b
}

sample.css

.sky>ellipse {
    fill: deepskyblue;
}

.ground>ellipse {
    fill: palegreen;
}

command

dot -Tsvg < sample.dot > sample.svg

sample.svg

enter image description here

like image 190
haba713 Avatar answered Oct 16 '25 08:10

haba713



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!