blob: e7164e1846dd8ec17d24f5ac41cb96f60c8b1f13 (
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 StyleBuilder func() lipgloss.Style
type Style struct {
style *lipgloss.Style
builder StyleBuilder
}
func New(builder StyleBuilder) 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...)
}
|