Skip to content

Commit

Permalink
color dependency kind
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseduffield committed Apr 12, 2020
1 parent 227acd0 commit 274a01c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/gui/presentation/dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/fatih/color"
"github.com/jesseduffield/lazynpm/pkg/commands"
"github.com/jesseduffield/lazynpm/pkg/theme"
"github.com/jesseduffield/lazynpm/pkg/utils"
"github.com/jesseduffield/semver/v3"
)
Expand Down Expand Up @@ -35,7 +36,14 @@ func getDepDisplayStrings(d *commands.Dependency) []string {
localVersionCol = utils.ColoredString("missing", color.FgRed)
}

return []string{d.Name, d.Kind, utils.ColoredString(d.Version, color.FgMagenta), localVersionCol}
kindColorMap := map[string]color.Attribute{
"prod": color.FgYellow,
"dev": color.FgGreen,
"peer": color.FgMagenta,
"optional": theme.DefaultTextColor,
}

return []string{d.Name, utils.ColoredString(d.Kind, kindColorMap[d.Kind]), utils.ColoredString(d.Version, color.FgMagenta), localVersionCol}
}

func statusMap() map[int]string {
Expand Down

0 comments on commit 274a01c

Please # to comment.