Get a themed font stack that works well across systems.
system_fonts(name="system-ui")
A font stack can be obtained from system_fonts() using one of various keywords such as "system-ui", "old-style", and "humanist" (there are 15 in total) representing a themed set of fonts. These sets comprise a font family that has been tested to work across a wide range of computer systems.
Parameters
name: FontStackName = "system-ui"
-
The name of a font stack. Must be drawn from the set of
"system-ui" (the default), "transitional", "old-style", "humanist", "geometric-humanist", "classical-humanist", "neo-grotesque", "monospace-slab-serif", "monospace-code", "industrial", "rounded-sans", "slab-serif", "antique", "didone", and "handwritten".
Returns
list[str]
-
A list of font names that make up the font stack.
Examples
Using select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll set a font for the entire table using the tab_options() method with the table_font_names parameter. Instead of passing a list of font names, we’ll use the system_fonts() helper function to get a font stack. In this case, we’ll use the "industrial" font stack.
from great_tables import GT, exibble, md, system_fonts
(
GT(
exibble[["num", "char", "currency", "row", "group"]],
rowname_col="row",
groupname_col="group"
)
.tab_header(
title=md("Data listing from **exibble**"),
subtitle=md("`exibble` is a **Great Tables** dataset.")
)
.fmt_number(columns="num")
.fmt_currency(columns="currency")
.tab_source_note(source_note="This is only a subset of the dataset.")
.opt_align_table_header(align="left")
.tab_options(table_font_names=system_fonts("industrial"))
)
| Data listing from exibble |
| exibble is a Great Tables dataset. |
|
num |
char |
currency |
| grp_a |
| row_1 |
0.11 |
apricot |
$49.95 |
| row_2 |
2.22 |
banana |
$17.95 |
| row_3 |
33.33 |
coconut |
$1.39 |
| row_4 |
444.40 |
durian |
$65,100.00 |
| grp_b |
| row_5 |
5,550.00 |
|
$1,325.81 |
| row_6 |
|
fig |
$13.26 |
| row_7 |
777,000.00 |
grapefruit |
|
| row_8 |
8,880,000.00 |
honeydew |
$0.44 |
| This is only a subset of the dataset. |
Invoking the system_fonts() helper function with the "industrial" argument will return a list of font names that make up the font stack. This is exactly the type of input that the table_font_names parameter requires.