UI components + themes for lipgloss, glamour, and bubbletea
MIT License
go get github.com/brittonhayes/glitter
View all the examples in here
Let's create a simple button with the Monokai theme that has a purple background and black text.
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)
}
Now let's use a few different components together to make a tutorial screen using the Gruvbox theme.
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)
}