Overview
The quarto package includes helper functions for theming plotting and table packages.
The functions return theme objects or functions, which are applied differently depending on the package.
These are simple helper functions to get you started. Copy them if you to customize them further.
This vignette demonstrates adding background and foreground colors to outputs from each package using the theme_colors_*
functions.
Please see light/dark renderings examples for examples using each supported package with dark mode, theme_brand_*
, and renderings: [light, dark]
flextable
Demonstrates a flextable with green foreground and yellow background.
library(flextable)
library(quarto)
yellow_green_theme <- theme_colors_flextable("#e3e5a9", "#165b26")
ft <- flextable(airquality[ sample.int(10),])
ft <- add_header_row(ft,
colwidths = c(4, 2),
values = c("Air quality", "Time")
)
ft <- theme_vanilla(ft)
ft <- add_footer_lines(ft, "Daily air quality measurements in New York, May to September 1973.")
ft <- color(ft, part = "footer", color = "#666666")
ft <- set_caption(ft, caption = "New York Air Quality Measurements")
ft |> yellow_green_theme()
Air quality |
Time |
Ozone |
Solar.R |
Wind |
Temp |
Month |
Day |
41 |
190 |
7.4 |
67 |
5 |
1 |
36 |
118 |
8.0 |
72 |
5 |
2 |
28 |
|
14.9 |
66 |
5 |
6 |
12 |
149 |
12.6 |
74 |
5 |
3 |
18 |
313 |
11.5 |
62 |
5 |
4 |
8 |
19 |
20.1 |
61 |
5 |
9 |
|
194 |
8.6 |
69 |
5 |
10 |
19 |
99 |
13.8 |
59 |
5 |
8 |
|
|
14.3 |
56 |
5 |
5 |
23 |
299 |
8.6 |
65 |
5 |
7 |
Daily air quality measurements in New York, May to September 1973. |
ggiraph
Demonstrates a ggiraph interactive plot with deep blue background and mauve foreground.
ggplot2
Demonstrates a ggplot2 plot with near-black background and green-grey foreground.
gt
Demonstrates a gt table with light green background and black foreground.
Asia |
16988 |
Africa |
11506 |
North America |
9390 |
South America |
6795 |
Antarctica |
5500 |
Europe |
3745 |
Australia |
2968 |
Greenland |
840 |
New Guinea |
306 |
Borneo |
280 |
plotly
Demonstrates a heatmaply interactive heatmap with a dark green background background and light blue foreground.
thematic
Demonstrates a patchwork plot with dark red background and light grey foreground.