theme-bw

Black-and-white theme: white panel, black axes, light grey grid.

Usage

theme-bw(
  ink: _tr-ink,
  paper: _tr-paper,
  accent: rgb("#3366FF"),
  ..fields,
)

Parameters

Parameter Default Description
ink _tr-ink Foreground colour (axis lines, text). Default: black.
paper _tr-paper Background colour. Default: white.
accent rgb("#3366FF") Accent colour. Default: rgb("#3366FF").
..fields Extra overrides forwarded to theme; see its docs for the full catalogue of structured and flat keys.

Returns

Theme dictionary consumed by plot.

Examples

Default black-on-white theme with a thin panel border.

#let d = range(0, 10).map(i => (x: i, y: i * 0.5))
#plot(
  data: d,
  mapping: aes(x: "x", y: "y"),
  layers: (geom-point(size: 2pt),),
  theme: theme-bw(),
  width: 10cm,
  height: 6cm,
)

Scatter plot of y against x on a white panel framed by a thin black border with light grey grid lines.

Scatter plot of y against x on a white panel framed by a thin black border with light grey grid lines.

Override accent to recolour data ink and key glyphs while keeping the high-contrast panel.

#let d = range(0, 10).map(i => (x: i, y: i * 0.5))
#plot(
  data: d,
  mapping: aes(x: "x", y: "y"),
  layers: (geom-point(size: 2pt),),
  theme: theme-bw(accent: rgb("#cc0000")),
  width: 10cm,
  height: 6cm,
)

Scatter plot of y against x on the bw theme with a red accent recolouring data ink against the high-contrast white panel.

Scatter plot of y against x on the bw theme with a red accent recolouring data ink against the high-contrast white panel.

Recolour the panel background on top of the bw preset.

#let d = range(0, 10).map(i => (x: i, y: i * 0.5))
#plot(
  data: d,
  mapping: aes(x: "x", y: "y"),
  layers: (geom-point(size: 2pt),),
  theme: theme-bw(panel-background: element-rect(fill: rgb("#ff9900"))),
  width: 10cm,
  height: 6cm,
)

Scatter plot of y against x on the bw theme with an orange panel background replacing the default white fill.

Scatter plot of y against x on the bw theme with an orange panel background replacing the default white fill.

See also

theme-grey, theme-minimal, theme-classic, theme-void, theme.

Back to top