works now

This commit is contained in:
Robin Olsen
2026-03-18 11:58:31 +01:00
parent 40d25cc716
commit 3e9a903506
24 changed files with 154 additions and 99 deletions

View File

@@ -5,10 +5,44 @@ import (
"charm.land/lipgloss/v2"
)
func HuhCenterTheme() *huh.Styles {
theme := huh.ThemeBase16(true)
// BaseTheme wraps huh.ThemeBase for use as a huh.Theme
type BaseTheme struct{}
theme.Focused.Base = lipgloss.NewStyle().Align(lipgloss.Center)
func (t BaseTheme) Theme(isDark bool) *huh.Styles {
return huh.ThemeBase(isDark)
}
// Base16Theme wraps huh.ThemeBase16 for use as a huh.Theme
type Base16Theme struct{}
func (t Base16Theme) Theme(isDark bool) *huh.Styles {
return huh.ThemeBase16(isDark)
}
// CenterTheme is a theme that centers form content while preserving ThemeBase16 styling
type CenterTheme struct{}
func (t CenterTheme) Theme(isDark bool) *huh.Styles {
theme := huh.ThemeBase16(isDark)
// Center the field content
theme.Focused.Base = theme.Focused.Base.Align(lipgloss.Center)
theme.Focused.Card = lipgloss.NewStyle() // Remove card border
theme.Group.Base = lipgloss.NewStyle() // Remove group padding
return theme
}
// HuhCenterTheme returns a center-aligned theme for questionnaires
func HuhCenterTheme() huh.Theme {
return CenterTheme{}
}
// HuhBaseTheme returns a base theme
func HuhBaseTheme() huh.Theme {
return BaseTheme{}
}
// HuhBase16Theme returns a base16 theme
func HuhBase16Theme() huh.Theme {
return Base16Theme{}
}