blob: 58237feb78f5b4e914fc2eb68482a5fcab38716c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package style
import "github.com/charmbracelet/lipgloss"
type Builder func() lipgloss.Style
type Style struct {
style *lipgloss.Style
builder Builder
}
func New(builder Builder) Style {
return Style{
builder: builder,
}
}
func (s *Style) Get() lipgloss.Style {
if s.style == nil {
st := s.builder()
s.style = &st
}
return *s.style
}
func (s *Style) Render(input ...string) string {
return s.Get().Render(input...)
}
|