|
@@ -23,7 +23,7 @@ type Panel struct {
|
|
|
BorderColor string
|
|
|
Lines []Line
|
|
|
Title string
|
|
|
- TitleColor string
|
|
|
+ TitleColor string
|
|
|
TitleOffset int
|
|
|
}
|
|
|
|
|
@@ -164,3 +164,16 @@ func (p *Panel) Spacer() Line {
|
|
|
l.Text = strings.Repeat(BOXES[pos].top, p.Width)
|
|
|
return l
|
|
|
}
|
|
|
+
|
|
|
+func (p *Panel) Center() {
|
|
|
+ p.CenterX()
|
|
|
+ p.CenterY()
|
|
|
+}
|
|
|
+
|
|
|
+func (p *Panel) CenterX() {
|
|
|
+ p.X = (Width - p.Width) / 2
|
|
|
+}
|
|
|
+
|
|
|
+func (p *Panel) CenterY() {
|
|
|
+ p.Y = (Height - len(p.Lines)) / 2
|
|
|
+}
|