Skip to content

Commit

Permalink
feat: add color styles
Browse files Browse the repository at this point in the history
  • Loading branch information
forivall committed Jul 9, 2022
1 parent 555e94f commit af25d3d
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,44 @@ func parseColumns(cols string) ([]int, error) {
// parseStyle converts user-provided style option into a table.Style.
func parseStyle(styleOpt string) (table.Style, error) {
switch styleOpt {
case "unicode":
case "unicode", "round":
return table.StyleRounded, nil
case "ascii":
return table.StyleDefault, nil
case "bold":
return table.StyleBold, nil
case "square":
return table.StyleLight, nil
case "double":
return table.StyleDouble, nil
case "color-bright":
return table.StyleColoredBright, nil
case "color-dark":
return table.StyleColoredDark, nil
case "color-bright-blue":
return table.StyleColoredBlackOnBlueWhite, nil
case "color-bright-cyan":
return table.StyleColoredBlackOnCyanWhite, nil
case "color-bright-green":
return table.StyleColoredBlackOnGreenWhite, nil
case "color-bright-magenta":
return table.StyleColoredBlackOnMagentaWhite, nil
case "color-bright-yellow":
return table.StyleColoredBlackOnYellowWhite, nil
case "color-bright-red":
return table.StyleColoredBlackOnRedWhite, nil
case "color-dark-blue":
return table.StyleColoredBlueWhiteOnBlack, nil
case "color-dark-cyan":
return table.StyleColoredCyanWhiteOnBlack, nil
case "color-dark-green":
return table.StyleColoredGreenWhiteOnBlack, nil
case "color-dark-magenta":
return table.StyleColoredMagentaWhiteOnBlack, nil
case "color-dark-red":
return table.StyleColoredRedWhiteOnBlack, nil
case "color-dark-yellow":
return table.StyleColoredYellowWhiteOnBlack, nil
default:
return table.Style{}, fmt.Errorf("unknown style option: %s", styleOpt)
}
Expand Down

0 comments on commit af25d3d

Please sign in to comment.