github.com/box-cli-maker/box-cli-maker/v3
Package box renders styled boxes around text for terminal applications. The core type is Box, constructed with NewBox and configured via a fluent API. Boxes support multiple built‑in styles, title positions, alignment, wrapping, and ANSI/truecolor output. Basic example: It is recommended to create boxes using NewBox, which returns a Box with sensible defaults. The returned Box can then be configured using methods such as Style, Padding, ContentAlign, Color, TitleColor, and TitlePosition. The zero value of Box is not intended to be used directly with Render. If you construct a Box manually (e.g. with &box.Box{} or new(box.Box)), you must fully initialize all required fields (style, padding, glyphs, colors, etc.) yourself before calling Render. Box styles are selected with Style and the BoxStyle constants: You can further customize any style by overriding the corner and edge glyphs using TopRight, TopLeft, BottomRight, BottomLeft, Horizontal, and Vertical. Titles can be placed inside the box, on the top border, or on the bottom border using TitlePosition with the TitlePosition constants: Content alignment is controlled with ContentAlign and the AlignType constants: WrapContent enables or disables automatic wrapping of the content. By default, when wrapping is enabled, the box width is based on two‑thirds of the terminal width. WrapLimit can be used to set an explicit maximum width. TitleColor, ContentColor, and Color accept either one of the first 16 ANSI color name constants (e.g. box.Green, box.BrightRed) or a #RGB / #RRGGBB / rgb:RRRR/GGGG/BBBB / rgba:RRRR/GGGG/BBBB/AAAA value. Invalid colors cause Render to return an error. Render returns an error if the style or title position is invalid, the wrap limit or padding is negative, a multiline title is used with a non‑Inside title position, any configured colors are invalid, or the terminal width cannot be determined. MustRender is a convenience wrapper that panics on error. Copy returns a shallow copy of a Box so you can define a base style and derive variants without mutating the original: Each Copy can then be customized and rendered independently.
proxy.golang.org
v3.0.0
26 days ago
1
Links
| Registry | proxy.golang.org |
| Source | Repository |
| Docs | Documentation |
| JSON API | View JSON |
| CodeMeta | codemeta.json |
Package Details
Repository
| Stars | 615 on GitHub |
| Forks | 24 on GitHub |