Skip to content

Commit

Permalink
docs: add themes to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
maaslalani committed Nov 10, 2023
1 parent 50a0f77 commit 86f27cc
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.gif filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<img alt="Charm-themed form" width="400" src="./examples/theme/charm-theme.png">

### Dracula Theme

<img alt="Dracula-themed form" width="400" src="./examples/theme/dracula-theme.png">

### Base 16 Theme

<img alt="Base16-themed form" width="400" src="./examples/theme/basesixteen-theme.png">

### Default Theme

<img alt="Default-themed form" width="400" src="./examples/theme/default-theme.png">


## Spinner

Huh additionally provides a `spinner` subpackage for displaying spinners while
Expand Down
3 changes: 3 additions & 0 deletions examples/theme/basesixteen-theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions examples/theme/charm-theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions examples/theme/default-theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions examples/theme/dracula-theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion examples/theme/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
39 changes: 39 additions & 0 deletions examples/theme/theme.tape
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 86f27cc

Please sign in to comment.