sampler-fork/component/block.go

20 lines
429 B
Go
Raw Permalink Normal View History

2019-03-16 23:59:28 +00:00
package component
import (
"fmt"
2019-03-16 23:59:28 +00:00
ui "github.com/gizak/termui/v3"
"github.com/sqshq/sampler/console"
2019-03-16 23:59:28 +00:00
)
func NewBlock(title string, border bool, palette console.Palette) *ui.Block {
style := ui.Style{Fg: palette.BaseColor, Bg: ui.ColorClear}
2019-03-16 23:59:28 +00:00
block := ui.NewBlock()
block.Border = border
block.BorderStyle = style
block.TitleStyle = style
if len(title) > 0 {
block.Title = fmt.Sprintf(" %s ", title)
}
2019-03-16 23:59:28 +00:00
return block
}