@@ -599,6 +599,7 @@ pub enum RenderOption {
599
599
NoNodeStyles ,
600
600
601
601
Monospace ,
602
+ DarkTheme ,
602
603
}
603
604
604
605
/// Returns vec holding all the default render options.
@@ -630,10 +631,23 @@ where
630
631
writeln ! ( w, "digraph {} {{" , g. graph_id( ) . as_slice( ) ) ?;
631
632
632
633
// Global graph properties
634
+ let mut graph_attrs = Vec :: new ( ) ;
635
+ let mut content_attrs = Vec :: new ( ) ;
633
636
if options. contains ( & RenderOption :: Monospace ) {
634
- writeln ! ( w, r#" graph[fontname="monospace"];"# ) ?;
635
- writeln ! ( w, r#" node[fontname="monospace"];"# ) ?;
636
- writeln ! ( w, r#" edge[fontname="monospace"];"# ) ?;
637
+ let font = r#"fontname="Courier, monospace""# ;
638
+ graph_attrs. push ( font) ;
639
+ content_attrs. push ( font) ;
640
+ } ;
641
+ if options. contains ( & RenderOption :: DarkTheme ) {
642
+ graph_attrs. push ( r#"bgcolor="black""# ) ;
643
+ content_attrs. push ( r#"color="white""# ) ;
644
+ content_attrs. push ( r#"fontcolor="white""# ) ;
645
+ }
646
+ if !( graph_attrs. is_empty ( ) && content_attrs. is_empty ( ) ) {
647
+ writeln ! ( w, r#" graph[{}];"# , graph_attrs. join( " " ) ) ?;
648
+ let content_attrs_str = content_attrs. join ( " " ) ;
649
+ writeln ! ( w, r#" node[{}];"# , content_attrs_str) ?;
650
+ writeln ! ( w, r#" edge[{}];"# , content_attrs_str) ?;
637
651
}
638
652
639
653
for n in g. nodes ( ) . iter ( ) {
0 commit comments