nidi3 / graphviz-java

Use graphviz with pure java
Apache License 2.0
934 stars 107 forks source link

How to set `fillcolor` for kotlin DSL? #243

Open scarf005 opened 1 year ago

scarf005 commented 1 year ago
fun <T : Comparable<T>> BinaryTree<T>.toGraphviz(): Graphviz =
    graph(directed = true) {
        node[
            Color.DARKSLATEGRAY,
            "fillcolor" eq "azure2",
            Font.name("Ubuntu Mono"),
            Font.size(20),
            Style.FILLED,
        ]
    }
        .addNode(this)
        .toGraphviz()

In this code, outline color can be set using Color.DARKSLATEGRAY, however I could not find a way to do the same for fillcolor, and had to use "attr" eq "value" notation.

Are there a way to set fillcolor the same way as color? Being able to use java.Color for fillcolor would be useful since "attr" eq "value" cannot type check.