From 86f27cce12b4d85eb7489f35cb7190b3a08efc1e Mon Sep 17 00:00:00 2001 From: Maas Lalani Date: Thu, 9 Nov 2023 21:39:46 -0500 Subject: [PATCH] docs: add themes to readme --- .gitattributes | 1 + README.md | 29 +++++++++++++++++++++ examples/theme/basesixteen-theme.png | 3 +++ examples/theme/charm-theme.png | 3 +++ examples/theme/default-theme.png | 3 +++ examples/theme/dracula-theme.png | 3 +++ examples/theme/main.go | 1 - examples/theme/theme.tape | 39 ++++++++++++++++++++++++++++ 8 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 examples/theme/basesixteen-theme.png create mode 100644 examples/theme/charm-theme.png create mode 100644 examples/theme/default-theme.png create mode 100644 examples/theme/dracula-theme.png create mode 100644 examples/theme/theme.tape diff --git a/.gitattributes b/.gitattributes index d41a9404..5f9b1ec3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ *.gif filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md index ee9db3a6..127ca1bb 100644 --- a/README.md +++ b/README.md @@ -173,6 +173,35 @@ huh.NewConfirm(). Value(&confirm) ``` +## Themes + +Huh forms can be customized through themes. You can supply your own custom theme +or use the predefined themes. + +There are currently four predefined themes: + +* [`Charm`](#charm-theme) +* [`Dracula`](#dracula-theme) +* [`Base 16`](#base-16-theme) +* [`Default`](#default-theme) + +### Charm Theme + +Charm-themed form + +### Dracula Theme + +Dracula-themed form + +### Base 16 Theme + +Base16-themed form + +### Default Theme + +Default-themed form + + ## Spinner Huh additionally provides a `spinner` subpackage for displaying spinners while diff --git a/examples/theme/basesixteen-theme.png b/examples/theme/basesixteen-theme.png new file mode 100644 index 00000000..0e661e4a --- /dev/null +++ b/examples/theme/basesixteen-theme.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:788b7b1e8b66c5e2a8f31b28d2621acb6ddcce979ed32350a4b347034dabc86a +size 37893 diff --git a/examples/theme/charm-theme.png b/examples/theme/charm-theme.png new file mode 100644 index 00000000..78b9308b --- /dev/null +++ b/examples/theme/charm-theme.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c4dbd6d11dfd41ee2232cc8d09fb22141f10bd7ad5326aaafb82573536fbb3e7 +size 42762 diff --git a/examples/theme/default-theme.png b/examples/theme/default-theme.png new file mode 100644 index 00000000..c003bed6 --- /dev/null +++ b/examples/theme/default-theme.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e3f85f2e39c2803634d1ff11583eb80cdf8a60b7316fa2c18e0ac13f3c35c831 +size 38741 diff --git a/examples/theme/dracula-theme.png b/examples/theme/dracula-theme.png new file mode 100644 index 00000000..5bad4083 --- /dev/null +++ b/examples/theme/dracula-theme.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6820d9c090e64d001a529127b40c64f0ca881bee9330a89ffae8288e7a9fb278 +size 49866 diff --git a/examples/theme/main.go b/examples/theme/main.go index 58c3833f..4b69f92b 100644 --- a/examples/theme/main.go +++ b/examples/theme/main.go @@ -45,7 +45,6 @@ func main() { err = huh.NewForm( huh.NewGroup( huh.NewInput().Title("Thoughts").Placeholder("What's on your mind?"), - huh.NewText().Title("More Thoughts").Placeholder("What else is on your mind?"), huh.NewSelect[string]().Options(huh.NewOptions("A", "B", "C")...).Title("Colors"), huh.NewMultiSelect[string]().Options(huh.NewOptions("Red", "Green", "Yellow")...).Title("Letters"), huh.NewConfirm().Title("Again?").Description("Try another theme").Value(&repeat), diff --git a/examples/theme/theme.tape b/examples/theme/theme.tape new file mode 100644 index 00000000..a10174c8 --- /dev/null +++ b/examples/theme/theme.tape @@ -0,0 +1,39 @@ +Output theme.gif + +Set Width 800 +Set Height 650 +Set Padding 40 + +Hide +Type "go build -o theme ." +Enter +Ctrl+L +Sleep 500ms +Type "clear && ./theme" Enter +Show + +Sleep 2s + +Enter + +Screenshot default-theme.png + +Tab 4 +Down 1 +Enter + +Screenshot dracula-theme.png + +Tab 4 +Down 2 +Enter + +Screenshot basesixteen-theme.png + +Tab 4 +Down 3 +Enter + +Screenshot charm-theme.png + +Sleep 1s