-
Notifications
You must be signed in to change notification settings - Fork 219
Add a function to generate styled tables from presets #987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* master: (214 commits) Update .Rbuildignore Change names of vector formatting fns Update x_time.Rd Update x_markdown.Rd Update x_datetime.Rd Update format_vec.R Update x_bytes.Rd Update x_date.Rd Update format_vec.R Add note about data generation Update x_currency.Rd Update x_bytes.Rd Update format_vec.R Update help files using roxygen Update format_vec.R Update x_scientific.Rd Update x_integer.Rd Update format_vec.R Update x_integer.Rd Update x_number.Rd ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a couple of questions this time.
8000
One thing I need to do is check contrast levels (with white text on dark backgrounds). I don't think I have enough contrast in some cases and I'd like to pass all the checks at https://webaim.org/resources/contrastchecker/ before finalizing this. |
Cool, that's great. Please ask @batpigandme about a11y. It's a good important thing to check for those, but we should be using the same tooling across the org (it's possible you have already, in which case no need to check again!) |
Hey @batpigandme , I've been working on this PR for the The function essentially styles a gt table using a base exibble %>%
gt(rowname_col = "row", groupname_col = "group") %>%
summary_rows(
groups = "grp_a",
columns = c(num, currency),
fns = list(
min = ~min(., na.rm = TRUE),
max = ~max(., na.rm = TRUE)
)) %>%
grand_summary_rows(
columns = currency,
fns = list(
total = ~sum(., na.rm = TRUE)
)) %>%
tab_source_note(source_note = "This is a source note.") %>%
tab_footnote(
footnote = "This is a footnote.",
locations = cells_body(columns = 1, rows = 1)
) %>%
tab_header(
title = "The title of the table",
subtitle = "The table's subtitle"
) %>%
opt_stylize(style = 6, color = "cyan") I was able to manually check every combination of text and background color using the following two things:
Is this enough? Or did I miss something, perhaps a better piece of tooling? Happy to show all of this to you in a video call anytime. |
Great job, Rich! If the color contrasts pass those, you're good to go! |
Thanks, @batpigandme ! I feel much better about eventually merging this in now. @cscheid would you be able to re-review (when you’re back, that is) and possibly approve? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This PR adds the
opt_stylize()
function to enable the styling of a table based on a numbered style and color.Fixes: #238