Building a Go Theme Package for TUIs (Or How I Learned to Stop Hardcoding Colors)
From hardcoded themes to a full-blown package - building gogh-themes with AI, custom codegen, and a lot of Googling
Go is Fun With AI (Hear Me Out)
I've been building a lot of TUIs in Go lately and kind of obsessed with learning the language. It's a really fun language to write code with AI in because you have to really think about giving coding instructions, not just functional instructions.
Typically when developing NextJS apps or Python applications with AI (like I'm used to), the focus is more on file structure, componentry, APIs, and a different flavor of software architecture.
When I'm building TUIs I'm prompting things like:
"I just added an ascii alphabet to ascii.txt, it contains A-z, 0-9, and @ symbol, each character is 3 lines high with varying widths. Write a lookup table that takes in the users username, feeds it through the function, and displays the username in ascii letters at the bottom of the page."
It works really well when I prompt like this!
Also, I think SOTA models are sneakily good at Go and the Charmbracelet libraries. No real big breaking changes, most of the ecosystem was finished before major AI labs trained on the whole internet, meaning it should have good Charm Go code in the training data right?! Idk just a theory I have.
The Theme Problem
Back to the point - the theme library.
Vinay says to me: "Devs want to pick their colors, always let them"
This stuck. Vinay knows what hes talking about. So how could I do this? I've already hardcoded a few themes into some of the apps I built, but nothing robust or worth writing home about.
Enter Google
"themes.go go github colors"
Second result: https://github.com/Gogh-Co/Gogh
Digging around the repo I found a directory called themes/ with 361 YAML files with color definitions in it. BINGO.
But wait - is it nasty to just grab these people's work, push the YAMLs through a custom codegen tool I made, then use the package in TUIs I build?
I checked in with a mentor (Jarad) and he says:
"No that's what open source is they want you to do that but you should just need to credit them I have all of those themes in my dotfiles repo zshyzsh"
That was all the validation I needed.
Building It
Cue Claude:
"Pull down the themes folder from gogh-themes repo, write a custom generator that converts the 361 yaml files into a single go struct, release it as a package so I can integrate it into the TUI I just built"
I don't think v1 took more than 10 minutes. A dumbed-down 8-color version of what would become an awesome Go theme library.
Making It Better
Back at it:
- Added 16-color ANSI support (primary + bright colors)
- Integrated with Lipgloss (because they don't have theming built-in yet)
- Created a
/lipglosssubpackage with pre-wrappedlipgloss.Colortypes - Built an interactive demo with theme cycling and fuzzy search
And boom - I guess we built a whole theming package for building Bubble Tea apps.
The Result
import lipglossthemes "github.com/willyv3/gogh-themes/lipgloss"
// Get a theme
theme, _ := lipglossthemes.Get("Dracula")
// Use colors directly in styles
titleStyle := lipgloss.NewStyle().
Foreground(theme.BrightBlue).
Background(theme.Background).
Bold(true)
361 professional terminal themes, all compile-time constants, zero dependencies in the core package.
What's Next
Vinay is going to contribute and make sure I don't break anything or get somebody pwned.
The package is live: https://github.com/willyv3/gogh-themes
Appreciate the read!