rstudio / thematic

Theme ggplot2, lattice, and base graphics based on a few simple settings.
https://rstudio.github.io/thematic/
Other
244 stars 10 forks source link

Support for auto theming in quarto #125

Open cboettig opened 2 years ago

cboettig commented 2 years ago

Thanks for thematic, it's an amazing package, and love how magically it works with bootststrap themes in flexdashboard. I'm trying to migrate some dashboards to quarto now, where I'm again delighted to see the same clever use of bootstrap theme options, unfortunately I don't see how to activate thematic appropriately in this context. Am I missing something obvious?

previously I just used thematic_rmd() with no arguments and it automatically detected the bootstrap theme of my flexdashboard Rmds. now this has no effect, and I don't see how to manually opt into a theme.

cpsievert commented 2 years ago

I don't think auto theming will be able to work in quarto (it maybe could with Shiny), but you can always specify the colors and fonts directly in thematic_rmd(bg="black", fg="white", accent="blue")

cboettig commented 2 years ago

cool, thanks, I'll try that. Is there a way to refer to a bslib theme name? e.g. I tried something like thematic::set_theme("lux") but no luck.

(sorry clearly I don't have a good grasp of how the magic works here... I imagine in the flexdashboard case thematic is getting the bslib theme from the Rmd yaml header? it would be awesome to have something similar work with quarto (i.e. from the _quarto.yml) but clearly I haven't grok'd the plumbing)

cboettig commented 2 years ago

i.e. I see that auto_config() can call bslib::bs_get_variables(), and I can move bslib up on the priority order, but I don't see how to manually pass my choice of theme argument to bs_get_variables(). I imagine a syntax like auto_config(theme="lux", priority="bslib"), or something similar. Or maybe framing this more generally, it seems like thematic already knows how to utlize bootswatch themes as ggplot themes, but I don't see how we as users can access that functionality directly other than manually looking up the hex codes, fonts etc used by each bootswatch etc passing them to thematic_rmd ? just feels like I am really missing something.

melindahiggins2000 commented 1 year ago

I would like to echo @cboettig's request above. I too have been really enjoying the thematic_rmd() function to automatically apply themes to my plots. I would like to 2nd the request for this added functionality to also work with Quarto Documents. Thank you for a great package.