Skip to content

Commit

Permalink
feat: add 'run --dark-theme' (fix #68)
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Sep 24, 2018
1 parent b45e187 commit 51361fc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 2 additions & 0 deletions cmd_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type runOptions struct {
Destination string
DebugGraph bool
NoCompress bool
DarkTheme bool

Targets []string
//Preview bool
Expand All @@ -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")
Expand Down
20 changes: 12 additions & 8 deletions graphviz.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 51361fc

Please sign in to comment.