Configuring Printers
This page explains how to customize printers with options
The printers in PTerm can be configured with options. All printers follow a specific scheme.

Option Scheme

To get a new printer, with custom configuration, you can fork the existing Default variant of the printer and modify the option via its WithXxx methods.
pterm.DefaultXxx.WithXxx(option)
If you want to set multiple options, you can chain them:
pterm.DefaultXxx.WithOption(option).WithOption2(option2)

Overwriting Default Options

You can overwrite options of the Default printers. Those options will be applied globally. This can be used to modify the style or default values.
To overwrite an option of a default printer, you can assign a forked printer to the default printer variable.

Syntax

pterm.DefaultXxx = *pterm.DefaultXxx.WithXxx(option)

Example

pterm.DefaultHeader = *pterm.DefaultHeader.WithBackgroundStyle(pterm.NewStyle(pterm.BgBlue))
Copy link
Edit on GitHub
On this page
Option Scheme
Overwriting Default Options
Syntax
Example