Documentation ¶
Overview ¶
Package box renders messages inside boxes in the terminal.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Box ¶
type Box struct { // Horizontal padding in spaces between the border of the box and the content. // // By default it's 3 spaces. Px int // Vertical padding in lines between the border of the box and the content. // // By default it's 1 line. Py int // Color of the border of the box. // // By default it's bright yellow: aurora.YellowFg | aurora.BrightFg BorderColor aurora.Color // contains filtered or unexported fields }
Example ¶
package main import ( "github.com/logrusorgru/aurora" "libs.altipla.consulting/box" ) func main() { o := box.Box{} o.AddLine("foo", "bar") o.AddLine("before", aurora.Red("colored"), "after") o.Render() }
Output:
func (*Box) AddLine ¶
func (box *Box) AddLine(parts ...interface{})
AddLine adds a new line to the output content. It accepts multiple strings or aurora.Value for colored output.
o.AddLine("part1", "part2", "joined without spaces")
If you need colored output split the string, this function should be able to read every part individually to calculate the length correctly:
o.AddLine("before", aurora.Red("colored"), "after", aurora.Blue("another colored"))
Click to show internal directories.
Click to hide internal directories.