Skip to content

feat: add 'glow style init' command with 11 preset themes and live preview - #975

Open
12britz wants to merge 5 commits into
charmbracelet:masterfrom
12britz:style-init-command
Open

feat: add 'glow style init' command with 11 preset themes and live preview#975
12britz wants to merge 5 commits into
charmbracelet:masterfrom
12britz:style-init-command

Conversation

@12britz

@12britz 12britz commented Jun 13, 2026

Copy link
Copy Markdown

Summary

Add an interactive command glow style init for creating custom color stylesheets without writing JSON.

Pick from 11 preset color themes, see a live rendered preview, and save with one keypress.

Usage

glow style init              # pick a theme, preview, save
glow style init -o ~/theme.json

Then:

glow -s ~/.config/glow/style.json README.md

Flow

  1. Shows 11 numbered themes (Catppuccin Mocha/Latte, Nord, Gruvbox Dark/Light, Solarized Dark/Light, Tokyo Night, Dracula, One Dark, Random)
  2. User picks a number
  3. Renders a live markdown preview (h1, bold, italic, code, code block, blockquote, hr, link) with those colors
  4. Prompts: [S]ave, [R]andomize, [Q]uit

Files

File Change
style_cmd.go NEW — theme definitions, live preview via glamour, save/randomize/quit loop
main.go Register styleCmd
glow_test.go Tests for buildStyle()

12britz added 2 commits June 13, 2026 16:44
…r styles

Add an interactive CLI command 'glow style init' that walks users through
creating a custom glamour JSON stylesheet. Users are prompted for colors
for key markdown elements (document text, headings, code, links, etc.)
and the command generates a valid stylesheet that can be used with
'glow -s path/to/style.json'.

Fixes are included for the generated JSON: ANSI color codes and hex colors
are supported, and the output matches the glamour JSON format exactly.
…eview

Replace individual per-element prompts with a simple theme picker:
- 10 curated color themes (Catppuccin, Nord, Gruvbox, Solarized, etc.)
- 1 Random option for auto-generated color palettes
- Live markdown preview rendered with glamour showing h1, code, links, etc.
- Save/Re-randomize/Quit workflow
- No new dependencies needed
@12britz 12britz changed the title feat: add 'glow style init' interactive command to create custom color styles feat: add 'glow style init' command with 11 preset themes and live preview Jun 13, 2026
12britz added 3 commits June 13, 2026 17:33
…cancel

Replace numbered input with a Bubble Tea TUI:
- Arrow keys (↑/↓ or j/k) to browse 11 themes
- Color swatches show actual theme colors below the list
- Enter to save, Esc/q to cancel, r for random palette
- Live preview with color blocks for Text, H1, H1 Bg, H2, Code, Link
Show a rendered markdown snippet using glamour with the selected theme's colors.
Preview updates in real-time as user navigates themes with arrow keys.
Removes redundant color swatches in favor of actual rendered output.
Replace glamour-rendered markdown preview with direct lipgloss-rendered
color palette blocks and sample text that always set both foreground and
background colors. This ensures visibility regardless of terminal theme.

Palette shows colored blocks with ANSI codes for Text, H1, Code, Link,
HR, H1Bg. Sample section shows styled heading, subtitle, code, and link.
@12britz

12britz commented Jun 13, 2026

Copy link
Copy Markdown
Author

Fixed demo — now shows the actual TUI with ./glow style init:

glow style init demo

Navigating through themes with arrow keys and saving with Enter. The color blocks and sample text use explicit fg+bg so they're always visible regardless of terminal theme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant