Graphviz: Color only a field in a Record-based Node

后端 未结 2 1306
抹茶落季
抹茶落季 2020-12-10 04:05

Is there a way to add color to only a field in a record-based node. Like in the following example, can the field struct2:f0 alone be in different color?

digr         


        
相关标签:
2条回答
  • 2020-12-10 04:39

    I don't think this is possible.

    You may consider using HTML-like labels - you should be able to do everything you can do with record-based nodes, and more.

    From the above linked documentation page:

    The record-based shape has largely been superseded and greatly generalized by HTML-like labels. That is, instead of using shape=record, one might consider using shape=none and an HTML-like label.

    and

    Although HTML labels are not, strictly speaking, a shape, they can be viewed as a generalization of the record shapes described above. In particular, if a node has set its shape attribute to none or plaintext, the HTML label will be the node's shape.

    0 讨论(0)
  • 2020-12-10 04:53

    Try this:

      digraph G {
        "Record" [ label=<<table>
                              <tr>
                                  <td>A</td>
                                  <td bgcolor='#00CC11'>B</td>
                              </tr>
                           </table> 
                          >
                 ];
      }
    
    0 讨论(0)
提交回复
热议问题