Skip to content

Commit

Permalink
Use black+b color for headers
Browse files Browse the repository at this point in the history
  • Loading branch information
heaths committed Oct 12, 2023
1 parent 57496f5 commit 1fb8976
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/tableprinter/table_printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func NewWithWriter(w io.Writer, isTTY bool, maxWidth int, cs *iostreams.ColorSch
if isTTY && len(headers.columns) > 0 {
for _, header := range headers.columns {
// TODO: Consider truncating longer headers e.g., NUMBER, or removing unnecessary headers e.g., DESCRIPTION with no descriptions.
tp.AddField(strings.ToUpper(header), WithColor(cs.Bold))
tp.AddField(strings.ToUpper(header), WithColor(cs.GrayBold))
}
tp.EndRow()
}
Expand Down
12 changes: 12 additions & 0 deletions pkg/iostreams/color.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var (
bold = ansi.ColorFunc("default+b")
cyanBold = ansi.ColorFunc("cyan+b")
greenBold = ansi.ColorFunc("green+b")
grayBold = ansi.ColorFunc("black+b")

gray256 = func(t string) string {
return fmt.Sprintf("\x1b[%d;5;%dm%s\x1b[m", 38, 242, t)
Expand Down Expand Up @@ -104,6 +105,17 @@ func (c *ColorScheme) Grayf(t string, args ...interface{}) string {
return c.Gray(fmt.Sprintf(t, args...))
}

func (c *ColorScheme) GrayBold(t string) string {
if !c.enabled {
return t
}
return grayBold(t)
}

func (c *ColorScheme) GrayBoldf(t string, args ...interface{}) string {
return c.GrayBold(fmt.Sprintf(t, args...))
}

func (c *ColorScheme) Magenta(t string) string {
if !c.enabled {
return t
Expand Down

0 comments on commit 1fb8976

Please sign in to comment.