|
| 1 | +package table |
| 2 | + |
| 3 | +import "github.com/jedib0t/go-pretty/v6/text" |
| 4 | + |
| 5 | +// ColorOptions defines the ANSI colors to use for parts of the Table. |
| 6 | +type ColorOptions struct { |
| 7 | + Border text.Colors // borders (if nil, uses one of the below) |
| 8 | + Footer text.Colors // footer row(s) colors |
| 9 | + Header text.Colors // header row(s) colors |
| 10 | + IndexColumn text.Colors // index-column colors (row #, etc.) |
| 11 | + Row text.Colors // regular row(s) colors |
| 12 | + RowAlternate text.Colors // regular row(s) colors for the even-numbered rows |
| 13 | + Separator text.Colors // separators (if nil, uses one of the above) |
| 14 | +} |
| 15 | + |
| 16 | +var ( |
| 17 | + // ColorOptionsDefault defines sensible ANSI color options - basically NONE. |
| 18 | + ColorOptionsDefault = ColorOptions{} |
| 19 | + |
| 20 | + // ColorOptionsBright renders dark text on bright background. |
| 21 | + ColorOptionsBright = ColorOptionsBlackOnCyanWhite |
| 22 | + |
| 23 | + // ColorOptionsDark renders bright text on dark background. |
| 24 | + ColorOptionsDark = ColorOptionsCyanWhiteOnBlack |
| 25 | + |
| 26 | + // ColorOptionsBlackOnBlueWhite renders Black text on Blue/White background. |
| 27 | + ColorOptionsBlackOnBlueWhite = ColorOptions{ |
| 28 | + Footer: text.Colors{text.BgBlue, text.FgBlack}, |
| 29 | + Header: text.Colors{text.BgHiBlue, text.FgBlack}, |
| 30 | + IndexColumn: text.Colors{text.BgHiBlue, text.FgBlack}, |
| 31 | + Row: text.Colors{text.BgHiWhite, text.FgBlack}, |
| 32 | + RowAlternate: text.Colors{text.BgWhite, text.FgBlack}, |
| 33 | + } |
| 34 | + |
| 35 | + // ColorOptionsBlackOnCyanWhite renders Black text on Cyan/White background. |
| 36 | + ColorOptionsBlackOnCyanWhite = ColorOptions{ |
| 37 | + Footer: text.Colors{text.BgCyan, text.FgBlack}, |
| 38 | + Header: text.Colors{text.BgHiCyan, text.FgBlack}, |
| 39 | + IndexColumn: text.Colors{text.BgHiCyan, text.FgBlack}, |
| 40 | + Row: text.Colors{text.BgHiWhite, text.FgBlack}, |
| 41 | + RowAlternate: text.Colors{text.BgWhite, text.FgBlack}, |
| 42 | + } |
| 43 | + |
| 44 | + // ColorOptionsBlackOnGreenWhite renders Black text on Green/White |
| 45 | + // background. |
| 46 | + ColorOptionsBlackOnGreenWhite = ColorOptions{ |
| 47 | + Footer: text.Colors{text.BgGreen, text.FgBlack}, |
| 48 | + Header: text.Colors{text.BgHiGreen, text.FgBlack}, |
| 49 | + IndexColumn: text.Colors{text.BgHiGreen, text.FgBlack}, |
| 50 | + Row: text.Colors{text.BgHiWhite, text.FgBlack}, |
| 51 | + RowAlternate: text.Colors{text.BgWhite, text.FgBlack}, |
| 52 | + } |
| 53 | + |
| 54 | + // ColorOptionsBlackOnMagentaWhite renders Black text on Magenta/White |
| 55 | + // background. |
| 56 | + ColorOptionsBlackOnMagentaWhite = ColorOptions{ |
| 57 | + Footer: text.Colors{text.BgMagenta, text.FgBlack}, |
| 58 | + Header: text.Colors{text.BgHiMagenta, text.FgBlack}, |
| 59 | + IndexColumn: text.Colors{text.BgHiMagenta, text.FgBlack}, |
| 60 | + Row: text.Colors{text.BgHiWhite, text.FgBlack}, |
| 61 | + RowAlternate: text.Colors{text.BgWhite, text.FgBlack}, |
| 62 | + } |
| 63 | + |
| 64 | + // ColorOptionsBlackOnRedWhite renders Black text on Red/White background. |
| 65 | + ColorOptionsBlackOnRedWhite = ColorOptions{ |
| 66 | + Footer: text.Colors{text.BgRed, text.FgBlack}, |
| 67 | + Header: text.Colors{text.BgHiRed, text.FgBlack}, |
| 68 | + IndexColumn: text.Colors{text.BgHiRed, text.FgBlack}, |
| 69 | + Row: text.Colors{text.BgHiWhite, text.FgBlack}, |
| 70 | + RowAlternate: text.Colors{text.BgWhite, text.FgBlack}, |
| 71 | + } |
| 72 | + |
| 73 | + // ColorOptionsBlackOnYellowWhite renders Black text on Yellow/White |
| 74 | + // background. |
| 75 | + ColorOptionsBlackOnYellowWhite = ColorOptions{ |
| 76 | + Footer: text.Colors{text.BgYellow, text.FgBlack}, |
| 77 | + Header: text.Colors{text.BgHiYellow, text.FgBlack}, |
| 78 | + IndexColumn: text.Colors{text.BgHiYellow, text.FgBlack}, |
| 79 | + Row: text.Colors{text.BgHiWhite, text.FgBlack}, |
| 80 | + RowAlternate: text.Colors{text.BgWhite, text.FgBlack}, |
| 81 | + } |
| 82 | + |
| 83 | + // ColorOptionsBlueWhiteOnBlack renders Blue/White text on Black background. |
| 84 | + ColorOptionsBlueWhiteOnBlack = ColorOptions{ |
| 85 | + Footer: text.Colors{text.FgBlue, text.BgHiBlack}, |
| 86 | + Header: text.Colors{text.FgHiBlue, text.BgHiBlack}, |
| 87 | + IndexColumn: text.Colors{text.FgHiBlue, text.BgHiBlack}, |
| 88 | + Row: text.Colors{text.FgHiWhite, text.BgBlack}, |
| 89 | + RowAlternate: text.Colors{text.FgWhite, text.BgBlack}, |
| 90 | + } |
| 91 | + |
| 92 | + // ColorOptionsCyanWhiteOnBlack renders Cyan/White text on Black background. |
| 93 | + ColorOptionsCyanWhiteOnBlack = ColorOptions{ |
| 94 | + Footer: text.Colors{text.FgCyan, text.BgHiBlack}, |
| 95 | + Header: text.Colors{text.FgHiCyan, text.BgHiBlack}, |
| 96 | + IndexColumn: text.Colors{text.FgHiCyan, text.BgHiBlack}, |
| 97 | + Row: text.Colors{text.FgHiWhite, text.BgBlack}, |
| 98 | + RowAlternate: text.Colors{text.FgWhite, text.BgBlack}, |
| 99 | + } |
| 100 | + |
| 101 | + // ColorOptionsGreenWhiteOnBlack renders Green/White text on Black |
| 102 | + // background. |
| 103 | + ColorOptionsGreenWhiteOnBlack = ColorOptions{ |
| 104 | + Footer: text.Colors{text.FgGreen, text.BgHiBlack}, |
| 105 | + Header: text.Colors{text.FgHiGreen, text.BgHiBlack}, |
| 106 | + IndexColumn: text.Colors{text.FgHiGreen, text.BgHiBlack}, |
| 107 | + Row: text.Colors{text.FgHiWhite, text.BgBlack}, |
| 108 | + RowAlternate: text.Colors{text.FgWhite, text.BgBlack}, |
| 109 | + } |
| 110 | + |
| 111 | + // ColorOptionsMagentaWhiteOnBlack renders Magenta/White text on Black |
| 112 | + // background. |
| 113 | + ColorOptionsMagentaWhiteOnBlack = ColorOptions{ |
| 114 | + Footer: text.Colors{text.FgMagenta, text.BgHiBlack}, |
| 115 | + Header: text.Colors{text.FgHiMagenta, text.BgHiBlack}, |
| 116 | + IndexColumn: text.Colors{text.FgHiMagenta, text.BgHiBlack}, |
| 117 | + Row: text.Colors{text.FgHiWhite, text.BgBlack}, |
| 118 | + RowAlternate: text.Colors{text.FgWhite, text.BgBlack}, |
| 119 | + } |
| 120 | + |
| 121 | + // ColorOptionsRedWhiteOnBlack renders Red/White text on Black background. |
| 122 | + ColorOptionsRedWhiteOnBlack = ColorOptions{ |
| 123 | + Footer: text.Colors{text.FgRed, text.BgHiBlack}, |
| 124 | + Header: text.Colors{text.FgHiRed, text.BgHiBlack}, |
| 125 | + IndexColumn: text.Colors{text.FgHiRed, text.BgHiBlack}, |
| 126 | + Row: text.Colors{text.FgHiWhite, text.BgBlack}, |
| 127 | + RowAlternate: text.Colors{text.FgWhite, text.BgBlack}, |
| 128 | + } |
| 129 | + |
| 130 | + // ColorOptionsYellowWhiteOnBlack renders Yellow/White text on Black |
| 131 | + // background. |
| 132 | + ColorOptionsYellowWhiteOnBlack = ColorOptions{ |
| 133 | + Footer: text.Colors{text.FgYellow, text.BgHiBlack}, |
| 134 | + Header: text.Colors{text.FgHiYellow, text.BgHiBlack}, |
| 135 | + IndexColumn: text.Colors{text.FgHiYellow, text.BgHiBlack}, |
| 136 | + Row: text.Colors{text.FgHiWhite, text.BgBlack}, |
| 137 | + RowAlternate: text.Colors{text.FgWhite, text.BgBlack}, |
| 138 | + } |
| 139 | +) |
0 commit comments