From 51361fcf48b58ded3ca868f5190b413f171ce981 Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Mon, 24 Sep 2018 18:27:53 +0200 Subject: [PATCH] feat: add 'run --dark-theme' (fix #68) --- cmd_run.go | 2 ++ graphviz.go | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/cmd_run.go b/cmd_run.go index 9a777589f..cde429fc2 100644 --- a/cmd_run.go +++ b/cmd_run.go @@ -30,6 +30,7 @@ type runOptions struct { Destination string DebugGraph bool NoCompress bool + DarkTheme bool Targets []string //Preview bool @@ -46,6 +47,7 @@ func runSetupFlags(flags *pflag.FlagSet, opts *runOptions) { flags.BoolVarP(&opts.DebugGraph, "debug-graph", "", false, "debug graph") flags.BoolVarP(&opts.ShowOrphans, "show-orphans", "", false, "show issues not linked to an epic") flags.BoolVarP(&opts.NoCompress, "no-compress", "", false, "do not compress graph (no overlap)") + flags.BoolVarP(&opts.DarkTheme, "dark-theme", "", false, "dark theme") flags.StringVarP(&opts.EpicLabel, "epic-label", "", "epic", "label used for epics (empty means issues with dependencies but without dependants)") flags.StringVarP(&opts.Destination, "destination", "", "-", "destination ('-' for stdout)") flags.StringSliceVarP(&opts.AdditionalPulls, "additional-pull", "", []string{}, "additional pull that won't necessarily be displayed on the graph") diff --git a/graphviz.go b/graphviz.go index 1f7f15723..e6e36eb28 100644 --- a/graphviz.go +++ b/graphviz.go @@ -41,18 +41,22 @@ func graphviz(issues Issues, opts *runOptions) (string, error) { panicIfErr(g.SetName("G")) attrs := map[string]string{} attrs["truecolor"] = "true" - attrs["sep"] = "-0.7" - attrs["compound"] = "true" - attrs["splines"] = "true" attrs["rankdir"] = "RL" - attrs["ranksep"] = "0.3" - attrs["nodesep"] = "0.1" - attrs["margin"] = "0.2" - attrs["center"] = "true" - attrs["constraint"] = "false" + attrs["constraint"] = "true" + attrs["compound"] = "true" if !opts.NoCompress { + attrs["center"] = "true" + attrs["ranksep"] = "0.3" + attrs["nodesep"] = "0.1" + attrs["margin"] = "0.2" + attrs["sep"] = "-0.7" + attrs["constraint"] = "false" + attrs["splines"] = "true" attrs["overlap"] = "compress" } + if opts.DarkTheme { + attrs["bgcolor"] = "black" + } for k, v := range attrs { panicIfErr(g.AddAttr("G", k, v))