Is there a way to specify a colour scheme for GraphViz dots in Doxygen?

877 Views Asked by At

The default scheme isn't very bright and dots has different schemes that can be set when making graphs from the command-line. Doxygen exposes DOT_FONTNAME to pass a font argument to dots but doesn't seem to have that for the color scheme? Does anyone know if there is a custom tag to set that, or a way to set a default scheme on GraphViz?

1

There are 1 best solutions below

2
On

You can use the Brewer colour schemes to define a "palette" of colours from which you can choose one with an index (1, 2, 3, ...).

When you want to change the palette, you just have to change the default colour scheme for nodes (or edge, or graph), the actual display colour of all nodes in the graph will then be updated accordingly.

This example uses colour scheme set39:

digraph {
    node [colorscheme=set39];
    node [shape=rectangle, style="filled", fillcolor=1]
        a
    node [shape=ellipse, style="filled", fillcolor=4]
        b
    a -> b
}

enter image description here

By changing only the colorscheme property of the first node element (the "default"), you can change the colour of all nodes:

digraph {
    node [colorscheme=spectral10];
    node [shape=rectangle, style="filled", fillcolor=1]
        a
    node [shape=ellipse, style="filled", fillcolor=4]
        b
    a -> b
}

enter image description here