Skip to content

Instantly share code, notes, and snippets.

@bashbunni
bashbunni / main.go
Last active July 20, 2022 19:16
tea.Println Example
package main
import (
"log"
tea "github.com/charmbracelet/bubbletea"
)
type model struct {
p *tea.Program
@bashbunni
bashbunni / main.go
Created July 20, 2022 21:19
Gradiant Background Text
package main
import (
"fmt"
"image/color"
"github.com/charmbracelet/lipgloss"
"github.com/lucasb-eyer/go-colorful"
"github.com/muesli/gamut"
)
@bashbunni
bashbunni / main.go
Last active August 25, 2022 20:42
Exec example but using WithAltScreen() prints output to outside of the altscreen
package main
import (
"fmt"
"os"
"os/exec"
tea "github.com/charmbracelet/bubbletea"
)
@bashbunni
bashbunni / main.go
Last active September 3, 2022 03:27
catppuccin
import (
tea "github.com/charmbracelet/bubbletea"
)
func main() {
// init models, we can reset them at any time anyway
models = []tea.Model{NewInitialModel(), NewSpinnerParent()}
m := models[initialView]
p := tea.NewProgram(m)
if err := p.Start(); err != nil {
@bashbunni
bashbunni / main.go
Created September 7, 2022 17:55
Recolor Selected Items in List Bubble
package main
import (
"fmt"
"os"
"github.com/charmbracelet/bubbles/list"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
)
@bashbunni
bashbunni / main.go
Created September 7, 2022 22:51
Toggle Between List Examples
package main
import (
"fmt"
"os"
"github.com/charmbracelet/bubbles/list"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
)
@bashbunni
bashbunni / go.mod
Last active October 27, 2022 18:02 — forked from SamWolfs/delegate.go
Bubbles list: no full screen if secondary state
module gh
go 1.19
require (
github.com/charmbracelet/bubbles v0.14.0
github.com/charmbracelet/bubbletea v0.22.1
)
require (
@bashbunni
bashbunni / main.go
Created December 21, 2022 23:04
Bubbles Table Customization
package main
/* This gist shows a table bubble with custom styles and a special case
where the row will get highlighted red to show how to do conditional formatting*/
import (
"fmt"
"os"
"github.com/charmbracelet/bubbles/table"
@bashbunni
bashbunni / main.go
Created January 11, 2023 03:50
ValidateFunc Blocking Workaround
package main
import (
"fmt"
"log"
"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/textinput"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
@bashbunni
bashbunni / main.go
Created January 11, 2023 06:55
Redirect Output From Program
package main
import (
"bytes"
"fmt"
"os"
"os/exec"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"