Overview
Glow uses Glamour for markdown rendering, which supports custom styles defined in JSON format. Custom styles allow you to completely control how markdown is rendered in your terminal.Built-in Styles
Before creating custom styles, you may want to try Glow’s built-in styles:auto- Automatically adapts to your terminal’s background (dark or light)dark- Optimized for dark terminalslight- Optimized for light terminalspink- Pink color schemedracula- Dracula themetokyonight- Tokyo Night themenotty- Plain text output for non-TTY environments
Using Custom Styles
Via Command Line
Specify a path to your custom JSON style file:Via Configuration File
Set the style path in yourglow.yml:
Paths starting with
~ are automatically expanded to your home directory, and environment variables are resolved.Via Environment Variable
Use theGLAMOUR_STYLE environment variable:
Style File Structure
Glamour styles are defined as JSON files following theansi.StyleConfig schema. Here’s the basic structure:
Style Properties
Each element in your style can have these properties:Color Properties
| Property | Type | Description |
|---|---|---|
color | String | Foreground color (hex or ANSI) |
background_color | String | Background color (hex or ANSI) |
Text Formatting
| Property | Type | Description |
|---|---|---|
bold | Boolean | Bold text |
italic | Boolean | Italic text |
underline | Boolean | Underlined text |
strikethrough | Boolean | Strikethrough text |
faint | Boolean | Dim/faint text |
Layout Properties
| Property | Type | Description |
|---|---|---|
margin | Integer | Margin (in lines) |
indent | Integer | Indentation (in spaces) |
prefix | String | Text prefix |
suffix | String | Text suffix |
Styleable Elements
You can customize these markdown elements:Document Structure
document- Root document stylesblock_quote- Blockquote textparagraph- Regular paragraphs
Headings
heading- All headings (inherited by h1-h6)h1,h2,h3,h4,h5,h6- Individual heading levels
Text Styles
text- Regular textstrong- Bold text (bold)emph- Italic text (italic)strikethrough- Strikethrough (text)
Code
code- Inline codecode_block- Code blocks
Lists
list- All listsenumeration- Ordered listsitem- List items
Links and Images
link- Link textlink_text- Link labelimage- Image elementsimage_text- Image alt text
Tables
table- Table containertable_row- Table rowstable_cell- Table cellstable_header- Table headers
Other Elements
hr- Horizontal rulehtml_block- HTML blockshtml_span- Inline HTML
Example Custom Styles
Minimalist Style
High Contrast Style
Solarized Dark Style
Style File Locations
Recommended Directory Structure
Platform-Specific Paths
- Linux
- macOS
- Windows
Testing Custom Styles
Quick Test
Test your style without modifying your config:Create a Test Document
Create a markdown file with various elements to test:test.md
- List item 1
- List item 2
- Nested item
- Ordered item
- Another item
Blockquote textLink text
Table:
| Column 1 | Column 2 |
|---|---|
| Data 1 | Data 2 |
Auto Style Behavior
When usingstyle: "auto", Glow automatically selects the appropriate style:
utils/utils.go
Glamour Documentation
For complete documentation on Glamour styles, including advanced features and the full schema:Glamour Styles
Official Glamour style reference with complete examples and schema documentation
Troubleshooting
Style Not Loading
-
Verify the JSON syntax is valid:
- Check the file path is correct and accessible
-
Use an absolute path if relative paths aren’t working:
Colors Not Displaying
- Ensure your terminal supports 24-bit color (true color)
- Try using ANSI color codes instead of hex values
- Check your
$TERMenvironment variable
Style Validation
Glow validates the style file on load. If there’s an error:- File doesn’t exist
- Invalid JSON syntax
- Incorrect file permissions
Tips and Best Practices
- Start with a built-in style - Copy and modify an existing Glamour style
- Test incrementally - Make small changes and test frequently
- Use semantic colors - Keep related elements visually similar
- Consider accessibility - Ensure sufficient contrast
- Document your style - Add comments in a separate README file
- Version control - Keep your styles in a git repository