Skip to main content
Glow uses Glamour for rendering markdown with beautiful, customizable styles.

Built-in Styles

Glow includes several pre-configured styles from the Glamour library:
  • auto - Automatically detects your terminal’s background color and selects an appropriate style (default)
  • dark - Optimized for dark terminal backgrounds
  • light - Optimized for light terminal backgrounds
  • pink - A pink-themed style
  • dracula - Based on the popular Dracula color scheme
  • tokyo-night - Based on the Tokyo Night color scheme
  • notty - Special style for non-TTY output (pipes, redirects)

Using the —style Flag

Specify a style with the --style (or -s) flag:
glow README.md --style dark
glow document.md -s light

Auto Style Detection

The auto style (default) intelligently detects your terminal’s background color:
# Uses auto-detection
glow README.md

# Explicitly set auto style
glow README.md --style auto
When output is redirected or piped (non-TTY), Glow automatically uses the notty style unless you explicitly specify a different style.

Custom JSON Stylesheets

You can create custom styles using JSON configuration files. Pass the path to your custom stylesheet:
glow README.md --style ~/.config/glow/custom-style.json

Style Validation

Glow validates styles at startup:
func validateStyle(style string) error {
    if style != "auto" && styles.DefaultStyles[style] == nil {
        style = utils.ExpandPath(style)
        if _, err := os.Stat(style); errors.Is(err, fs.ErrNotExist) {
            return fmt.Errorf("specified style does not exist: %s", style)
        } else if err != nil {
            return fmt.Errorf("unable to stat file: %w", err)
        }
    }
    return nil
}
The validation process (main.go:151-163):
  1. Checks if the style is a built-in default
  2. If not, expands the file path (supports ~ and environment variables)
  3. Verifies the file exists

Terminal Background Detection

Glow uses Lipgloss to detect your terminal’s background color for the auto style:
switch style {
case styles.AutoStyle:
    if lipgloss.HasDarkBackground() {
        styleConfig = styles.DarkStyleConfig
    } else {
        styleConfig = styles.LightStyleConfig
    }
This ensures optimal contrast and readability regardless of your terminal theme.

Non-TTY Output

When Glow detects that stdout is not a terminal (e.g., when piping output), it automatically applies the notty style:
isTerminal := term.IsTerminal(int(os.Stdout.Fd()))
// We want to use a special no-TTY style, when stdout is not a terminal
// and there was no specific style passed by arg
if !isTerminal && !cmd.Flags().Changed("style") {
    style = "notty"
}
This style is optimized for:
  • File redirection
  • Piping to other commands
  • Non-interactive environments
Example:
# Automatically uses notty style
glow README.md > output.txt

# Override with explicit style
glow README.md --style dark > output.txt

Configuration File

Set a default style in your Glow configuration file (~/.config/glow/glow.yml):
style: dark

Learn More

Create and customize your own JSON stylesheets for complete control over markdown rendering

Examples

# Use the pink theme
glow --style pink example.md

# Use a custom style from your config directory
glow --style ~/.config/glow/my-theme.json README.md

# Force dark style even when piping
glow --style dark README.md | less

Build docs developers (and LLMs) love