change highlight color

This commit is contained in:
Josh Kraft 2023-04-26 19:15:31 -06:00
parent b0396d9af2
commit d82c65ac2f
2 changed files with 12 additions and 20 deletions

View file

@ -162,7 +162,7 @@ func displayResults(io *iostreams.IOStreams, results search.CodeResult, limit in
break
}
if io.IsStdoutTTY() {
tp.AddField(fmt.Sprintf("%s: %s", cs.YellowBold(strconv.Itoa(row+1)), line))
tp.AddField(fmt.Sprintf("%s: %s", cs.CyanBold(strconv.Itoa(row+1)), line))
} else {
tp.AddField(fmt.Sprintf("%s %s: %s", code.Repo.FullName, code.Path, line))
}
@ -186,7 +186,7 @@ func buildOutput(tm search.TextMatch, cs *iostreams.ColorScheme) (string, map[in
var out strings.Builder
for i, c := range tm.Fragment {
if shouldHighlight[i] {
out.WriteString(cs.Yellow(string(c)))
out.WriteString(cs.CyanBold(string(c)))
linesToPrint[line] = true
} else {
out.WriteRune(c)

View file

@ -9,17 +9,16 @@ import (
)
var (
magenta = ansi.ColorFunc("magenta")
cyan = ansi.ColorFunc("cyan")
red = ansi.ColorFunc("red")
yellow = ansi.ColorFunc("yellow")
blue = ansi.ColorFunc("blue")
green = ansi.ColorFunc("green")
gray = ansi.ColorFunc("black+h")
bold = ansi.ColorFunc("default+b")
cyanBold = ansi.ColorFunc("cyan+b")
greenBold = ansi.ColorFunc("green+b")
yellowBold = ansi.ColorFunc("yellow+b")
magenta = ansi.ColorFunc("magenta")
cyan = ansi.ColorFunc("cyan")
red = ansi.ColorFunc("red")
yellow = ansi.ColorFunc("yellow")
blue = ansi.ColorFunc("blue")
green = ansi.ColorFunc("green")
gray = ansi.ColorFunc("black+h")
bold = ansi.ColorFunc("default+b")
cyanBold = ansi.ColorFunc("cyan+b")
greenBold = ansi.ColorFunc("green+b")
gray256 = func(t string) string {
return fmt.Sprintf("\x1b[%d;5;%dm%s\x1b[m", 38, 242, t)
@ -73,13 +72,6 @@ func (c *ColorScheme) Yellowf(t string, args ...interface{}) string {
return c.Yellow(fmt.Sprintf(t, args...))
}
func (c *ColorScheme) YellowBold(t string) string {
if !c.enabled {
return t
}
return yellowBold(t)
}
func (c *ColorScheme) Green(t string) string {
if !c.enabled {
return t