Objective
After upgrading huh to v2 (see companion issue), migrate HuhTheme() in pkg/styles/huh_theme.go to use the new huh.ThemeFunc API (func(isDark bool) *huh.Styles), enabling proper dark/light terminal detection, and remove the obsolete lipgloss v1 compatibility comment.
Context
From discussion #24261 (Go Fan module review). In huh v2, themes are defined as huh.ThemeFunc = func(isDark bool) *huh.Styles and passed to forms as a function reference rather than a pointer value. The current code:
// Before (v0.8.0)
func HuhTheme() *huh.Theme { ... }
form.WithTheme(styles.HuhTheme()) // called, returns pointer
Should become:
// After (v2.x)
func HuhTheme(isDark bool) *huh.Styles { ... }
form.WithTheme(styles.HuhTheme) // pass function reference itself
The isDark bool parameter replaces the need for lipgloss.AdaptiveColor in color definitions — the theme can now make direct color decisions based on the terminal background.
Steps
-
In pkg/styles/huh_theme.go:
- Update function signature from
func HuhTheme() *huh.Theme to func HuhTheme(isDark bool) *huh.Styles
- Replace
lipgloss.AdaptiveColor{Light: ..., Dark: ...} patterns with direct color selection using isDark
- Remove the obsolete comment about lipgloss v1 / huh v0.8.0 compatibility
- Update the import to use
charm.land/lipgloss/v2 (the v1 import should already be gone after the dep upgrade)
-
Update all call sites across pkg/console/ and pkg/cli/ (approximately 19 NewForm call sites):
- Change
.WithTheme(styles.HuhTheme()) → .WithTheme(styles.HuhTheme) (pass the function reference, not the result)
-
Run make fmt and make lint
Files to Modify
pkg/styles/huh_theme.go — function signature, color logic, remove compat comment
- All files in
pkg/console/ and pkg/cli/ that call .WithTheme(styles.HuhTheme())
Acceptance Criteria
Generated by Plan Command for issue #discussion #24261 · ● 188.9K · ◷
Objective
After upgrading huh to v2 (see companion issue), migrate
HuhTheme()inpkg/styles/huh_theme.goto use the newhuh.ThemeFuncAPI (func(isDark bool) *huh.Styles), enabling proper dark/light terminal detection, and remove the obsolete lipgloss v1 compatibility comment.Context
From discussion #24261 (Go Fan module review). In huh v2, themes are defined as
huh.ThemeFunc = func(isDark bool) *huh.Stylesand passed to forms as a function reference rather than a pointer value. The current code:Should become:
The
isDark boolparameter replaces the need forlipgloss.AdaptiveColorin color definitions — the theme can now make direct color decisions based on the terminal background.Steps
In
pkg/styles/huh_theme.go:func HuhTheme() *huh.Themetofunc HuhTheme(isDark bool) *huh.Styleslipgloss.AdaptiveColor{Light: ..., Dark: ...}patterns with direct color selection usingisDarkcharm.land/lipgloss/v2(the v1 import should already be gone after the dep upgrade)Update all call sites across
pkg/console/andpkg/cli/(approximately 19NewFormcall sites):.WithTheme(styles.HuhTheme())→.WithTheme(styles.HuhTheme)(pass the function reference, not the result)Run
make fmtandmake lintFiles to Modify
pkg/styles/huh_theme.go— function signature, color logic, remove compat commentpkg/console/andpkg/cli/that call.WithTheme(styles.HuhTheme())Acceptance Criteria
HuhThemematches thehuh.ThemeFunctype signature.WithTheme(styles.HuhTheme())call sites updated to.WithTheme(styles.HuhTheme)make buildsucceedsmake test-unitpasses