great-tables
great-tables copied to clipboard
Add the `opt_table_font()` method
This adds the opt_table_font() method, which can be used for the easy addition of fonts (or a font stack) to the table. Here's an example where a font stack was used:
from great_tables import GT, exibble
gt_ex = (
GT(exibble.head(5), rowname_col="row", groupname_col="group")
.tab_header("THE HEADING", "(a subtitle)")
.tab_stubhead("THE STUBHEAD")
.tab_source_note("THE SOURCE NOTE")
.opt_table_font(stack="industrial")
)
gt_ex
Here's another example where a single font name is prepended to the list of default fonts:
from great_tables import GT, exibble
gt_ex = (
GT(exibble.head(5), rowname_col="row", groupname_col="group")
.tab_header("THE HEADING", "(a subtitle)")
.tab_stubhead("THE STUBHEAD")
.tab_source_note("THE SOURCE NOTE")
.opt_table_font(font="Comic Sans MS")
)
gt_ex
Fixes: https://github.com/posit-dev/great-tables/issues/175
Sounds good. PR #260 is ready for a re-review.
Codecov Report
Attention: Patch coverage is 85.71429% with 5 lines in your changes missing coverage. Please review.
Project coverage is 86.45%. Comparing base (
4f1af8d) to head (41b2a0f).
:exclamation: Current head 41b2a0f differs from pull request most recent head 11ddbb6
Please upload reports for the commit 11ddbb6 to get more accurate results.
| Files | Patch % | Lines |
|---|---|---|
| great_tables/_options.py | 85.29% | 5 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #272 +/- ##
==========================================
+ Coverage 86.44% 86.45% +0.01%
==========================================
Files 42 42
Lines 4654 4689 +35
==========================================
+ Hits 4023 4054 +31
- Misses 631 635 +4
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I've incorporated your suggestions in two commits. If CI passes I'll merge this PR. Thanks!