-
Notifications
You must be signed in to change notification settings - Fork 31
feat(experiment): apply similar theme to huh forms #421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
de4d0cb
5fe70e1
e84ae4f
5eab256
89bff6c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -126,6 +126,54 @@ func Chevron() string { | |
| return "❱" | ||
| } | ||
|
|
||
| // ThemeSurvey returns a huh Theme that matches the legacy survey prompt styling. | ||
| // Applied when experiment.Huh is on but experiment.Lipgloss is off. | ||
| func ThemeSurvey() huh.Theme { | ||
| return huh.ThemeFunc(themeSurvey) | ||
| } | ||
|
|
||
| // themeSurvey builds huh styles matching the survey library's appearance. | ||
| func themeSurvey(isDark bool) *huh.Styles { | ||
| t := huh.ThemeBase(isDark) | ||
|
|
||
| ansiBlue := lipgloss.ANSIColor(blue) | ||
| ansiGray := lipgloss.ANSIColor(gray) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👽 praise: This does solid in foreground text where used!
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ansiGreen := lipgloss.ANSIColor(green) | ||
| ansiRed := lipgloss.ANSIColor(red) | ||
|
|
||
| t.Focused.Title = lipgloss.NewStyle(). | ||
| Foreground(ansiGray). | ||
| Bold(true) | ||
|
Comment on lines
+144
to
+146
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🌲 praise: Nice use of bold formatting once more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| t.Focused.ErrorIndicator = lipgloss.NewStyle(). | ||
| Foreground(ansiRed). | ||
| SetString(" *") | ||
| t.Focused.ErrorMessage = lipgloss.NewStyle(). | ||
| Foreground(ansiRed) | ||
|
|
||
| // Select styles | ||
| t.Focused.SelectSelector = lipgloss.NewStyle(). | ||
| Foreground(ansiBlue). | ||
| Bold(true). | ||
| SetString(Chevron() + " ") | ||
| t.Focused.SelectedOption = lipgloss.NewStyle(). | ||
| Foreground(ansiBlue). | ||
| Bold(true) | ||
|
Comment on lines
+154
to
+160
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🌟 praise: These selections have a impressive similarities! The change to help text placement builds confidence in this next update I think!
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👾 issue(non-blocking): I notice the guided tutorials reference isn't included in the updated help description. 🪬 ramble: This might be a quick change to the |
||
|
|
||
| // Multi-select styles | ||
| t.Focused.MultiSelectSelector = lipgloss.NewStyle(). | ||
| Foreground(ansiBlue). | ||
| Bold(true). | ||
| SetString(Chevron() + " ") | ||
| t.Focused.SelectedPrefix = lipgloss.NewStyle(). | ||
| Foreground(ansiGreen). | ||
| SetString("[x] ") | ||
| t.Focused.UnselectedPrefix = lipgloss.NewStyle(). | ||
| Bold(true). | ||
| SetString("[ ] ") | ||
|
|
||
| return t | ||
| } | ||
|
|
||
| // SurveyIcons returns customizations to the appearance of survey prompts. | ||
| func SurveyIcons() survey.AskOpt { | ||
| if !isStyleEnabled { | ||
|
|
||






There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔭 thought: If we're changing the "—" separator to a character outside of the ASCII character sets we can perhaps use a new function to fallback to the common dash without styles?
👾 quibble: This might be a change to discuss in a separate PR. IMHO #400 isn't an experimental change but it was related to prompts at the time of these updates and gets confusing...