1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

Switch to github.com/gookit/color for terminal colors

This commit is contained in:
mjarkk
2021-07-27 15:00:37 +02:00
parent a3b820fb5f
commit 79848087bc
100 changed files with 12406 additions and 1704 deletions

View File

@ -7,8 +7,8 @@ import (
"os/exec"
"path/filepath"
"github.com/fatih/color"
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/gui/style"
"github.com/jesseduffield/lazygit/pkg/integration"
"github.com/jesseduffield/lazygit/pkg/secureexec"
)
@ -287,7 +287,7 @@ func (app *App) runSubprocess(cmd *exec.Cmd) {
cmd.Stderr = nil
cmd.Stdout = nil
fmt.Fprintf(os.Stdout, "\n%s", coloredString("press enter to return", color.FgGreen))
fmt.Fprintf(os.Stdout, "\n%s", style.FgGreen.Sprint("press enter to return"))
fmt.Scanln() // wait for enter press
if err := gocui.Screen.Resume(); err != nil {
@ -382,14 +382,3 @@ func (app *App) layout(g *gocui.Gui) error {
func quit(g *gocui.Gui, v *gocui.View) error {
return gocui.ErrQuit
}
func coloredString(str string, colorAttributes ...color.Attribute) string {
colour := color.New(colorAttributes...)
return coloredStringDirect(str, colour)
}
// coloredStringDirect used for aggregating a few color attributes rather than
// just sending a single one
func coloredStringDirect(str string, colour *color.Color) string {
return colour.SprintFunc()(fmt.Sprint(str))
}