diff options
| author | ewy <ewy0@protonmail.com> | 2026-04-14 16:37:17 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-04-14 16:37:17 +0200 |
| commit | 45a297a8e526094e8fce6e2c5c0fd89b381d1765 (patch) | |
| tree | 852ebc3a0112c94dc9726d0b27ab057bf6383660 /menu/style | |
i have to commit at some point!
Diffstat (limited to 'menu/style')
| -rw-r--r-- | menu/style/style.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/menu/style/style.go b/menu/style/style.go new file mode 100644 index 0000000..e7164e1 --- /dev/null +++ b/menu/style/style.go @@ -0,0 +1,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...) +} |
