Style selects one of the built-in BoxStyle presets. Common styles include box.Single, box.Double, box.Round, box.Bold, box.SingleDouble, box.DoubleSingle, box.Classic, box.Hidden, and box.Block. To make custom styles, call TopRight, TopLeft, BottomRight, BottomLeft, Horizontal, and Vertical after
(box BoxStyle)
| 103 | // b := box.NewBox() |
| 104 | // b.TopRight("+").TopLeft("+").BottomRight("+").BottomLeft("_").Horizontal("-").Vertical("|") |
| 105 | func (b *Box) Style(box BoxStyle) *Box { |
| 106 | b.config.style = box |
| 107 | b.styleSet = true |
| 108 | // Set the box style characters from predefined styles |
| 109 | // This also allows manual overrides after setting style |
| 110 | // and have a standard base. |
| 111 | if styleDef, ok := boxes[box]; ok { |
| 112 | b.BottomLeft(styleDef.bottomLeft). |
| 113 | BottomRight(styleDef.bottomRight). |
| 114 | TopLeft(styleDef.topLeft). |
| 115 | TopRight(styleDef.topRight). |
| 116 | Horizontal(styleDef.horizontal). |
| 117 | Vertical(styleDef.vertical) |
| 118 | } |
| 119 | return b |
| 120 | } |
| 121 | |
| 122 | // TopRight sets the glyph used in the upper-right corner. |
| 123 | func (b *Box) TopRight(glyph string) *Box { |