I have the following dot sample. I would like to give the first section in each record (the table name) a different background and foreground colour. I can\'t find any examp
I'm pretty sure that it's not possible. Instead you should use HTML-style labels, that are a more developped form of record nodes. You can define your node using the <table>
tag, and set the color using bgcolor="your_color"
. A list of available colors is available here: http://www.graphviz.org/doc/info/colors.html (you also have a RGBA way of doing it, as described here: http://www.graphviz.org/doc/info/attrs.html#k:color)
With HTML labels, your example becomes as follows:
digraph G
{
rankdir = LR;
node1
[
shape = none
label = <<table border="0" cellspacing="0">
<tr><td port="port1" border="1" bgcolor="red">corpus_language</td></tr>
<tr><td port="port2" border="1">id: en</td></tr>
<tr><td port="port3" border="1">name: Englist</td></tr>
<tr><td port="port4" border="1">sentence_count: 1027686</td></tr>
</table>>
]
node2
[
shape = none
label = <<table border="0" cellspacing="0">
<tr><td port="port1" border="1" bgcolor="blue">corpus_sentence</td></tr>
<tr><td port="port2" border="1">id: 1241798</td></tr>
<tr><td port="port3" border="1">text: Baseball is a sport</td></tr>
<tr><td port="port4" border="1">creator_id: 10859</td></tr>
<tr><td port="port5" border="1">created_on: 2006-11-14 17:58:09.303128</td></tr>
<tr><td port="port6" border="1">language_id: en</td></tr>
<tr><td port="port7" border="1">activity_id: 11</td></tr>
<tr><td port="port8" border="1">score: 124</td></tr>
</table>>
]
node1:port2 -> node2:port6 [label="language_id"]
}
Here is the result: