Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brittonhayes/glitter
UI components + themes for lipgloss, glamour, and bubbletea
https://github.com/brittonhayes/glitter
Last synced: 17 days ago
JSON representation
UI components + themes for lipgloss, glamour, and bubbletea
- Host: GitHub
- URL: https://github.com/brittonhayes/glitter
- Owner: brittonhayes
- License: mit
- Created: 2021-06-13T20:56:32.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-06-18T07:37:05.000Z (over 3 years ago)
- Last Synced: 2024-10-10T16:15:01.417Z (29 days ago)
- Language: Go
- Size: 92.8 KB
- Stars: 13
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ✨ Glitter ✨
> UI components + themes for [lipgloss](https://github.com/charmbracelet/lipgloss),
> [glamour](https://github.com/charmbracelet/glamour), and [bubbletea](https://github.com/charmbracelet/bubbletea)[![Go Reference](https://pkg.go.dev/badge/github.com/brittonhayes/glitter.svg)](https://pkg.go.dev/github.com/brittonhayes/glitter)
[![Go Report Card](https://goreportcard.com/badge/github.com/brittonhayes/glitter)](https://goreportcard.com/report/github.com/brittonhayes/glitter)
## Usage
```shell
go get github.com/brittonhayes/glitter
```View all the examples in [here](./_examples/)
### Button
Let's create a simple button with the Monokai theme that has
a purple background and black text.```go
func main() {
// Create a new glitter UI and select a theme
ui := glitter.NewUI(theme.Monokai)
// Create a button and mark it as active
btn := ui.Button("hello there", style.Info)
// Render the button!
fmt.Println(btn)
}
```### Banner
Now let's use a few different components together
to make a tutorial screen using the Gruvbox theme.```go
func main() {
ui := glitter.NewUI(theme.Gruvbox)var (
banner = ui.Banner("Welcome to Glitter!")
comment = ui.Comment("#", "Enter following command:")
prefix, prompt = ui.Prompt("$", "go get github.com/brittonhayes/glitter", false)
)// Print the banner
fmt.Println(banner)// Print the code comment
fmt.Println(comment)// Print the shell prompt
fmt.Println(prefix, prompt)
}
```