From e38574dfec94520c5d5eed62c5c095b3c4db9036 Mon Sep 17 00:00:00 2001 From: Antoine Grondin Date: Fri, 25 Oct 2024 16:27:20 +0900 Subject: [PATCH] refactor the huh theme setting a bit --- cmd/humanlog/main.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd/humanlog/main.go b/cmd/humanlog/main.go index 2a233705..919213bf 100644 --- a/cmd/humanlog/main.go +++ b/cmd/humanlog/main.go @@ -70,7 +70,14 @@ var ( defaultBaseSiteAddr = "https://humanlog.io" hideUnreleasedFeatures = "" - huhTheme = huh.ThemeCatppuccin() + huhTheme = func() *huh.Theme { + base := huh.ThemeCatppuccin() + base.Focused.FocusedButton = base.Focused.FocusedButton.Bold(true).Underline(true) + base.Focused.BlurredButton = base.Focused.BlurredButton.Bold(false).Underline(false).Strikethrough(true) + base.Blurred.FocusedButton = base.Focused.FocusedButton.Bold(true).Underline(true) + base.Blurred.BlurredButton = base.Focused.BlurredButton.Bold(false).Underline(false).Strikethrough(true) + return base + }() ) func fatalf(c *cli.Context, format string, args ...interface{}) { @@ -82,10 +89,6 @@ func fatalf(c *cli.Context, format string, args ...interface{}) { } func main() { - huhTheme.Focused.FocusedButton = huhTheme.Focused.FocusedButton.Bold(true).Underline(true) - huhTheme.Focused.BlurredButton = huhTheme.Focused.BlurredButton.Bold(false).Underline(false).Strikethrough(true) - huhTheme.Blurred.FocusedButton = huhTheme.Focused.FocusedButton.Bold(true).Underline(true) - huhTheme.Blurred.BlurredButton = huhTheme.Focused.BlurredButton.Bold(false).Underline(false).Strikethrough(true) app := newApp() prefix := rgbterm.FgString(app.Name+"> ", 99, 99, 99)