-
Notifications
You must be signed in to change notification settings - Fork 349
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
Feature suggestion: map (additional) Yaml variables to CSS :root #5982
Comments
For reference, the original discussion here: Originally posted by @baptiste in #5959 Here's a situation I encountered today: I have a custom Html template, say for Gandalf's resumé, and I wish to define the font colours in the Yaml header with something like:
where the Pandoc variables cannot be inserted into my custom CSS file (defining
and defining the variable in a custom template partial (where pandoc variables can be injected):
I came to this from a similar workaround in Latex (with macros instead of CSS variables). |
Thanks, this is very helpful. I don't know when we'll get to it, but at some point we have to make all of the theming options in quarto fit well together, and you've found an important aspect. |
(A comment from a lurker, mostly to add to—and maybe complicate, sorry 😬—that discussion, if/when it happens...) TL;DR: It'd be really helpful if there were ONE source of truth for theming, whether it's CSS variables (my preference), YAML settings, or SASS variables. My use case, contextI'm trying to use Quarto for the docs of an existing Vite project, that already has a It'd be amazing (though impossible for a lot of reasons) if I could just point Quarto to that file, ... but it's doing all kinds of runtime The first thing I tried was a hack like
Not sure how important things like that are for Quarto to do at compile time, but ... changing that approach might be a lower-effort way to make Quarto work with CSS variables? The correct thing for my project is probably to convert my But for ... more time than I'd like to admit..., I seriously considered writing a script to generate custom light/dark Bootswatch themes for Quarto, based on the Vite project's root CSS variables, mostly so I could stop worrying about where Quarto wants me to configure each color (and to avoid configuring SASS as a dependency to the Vite project, just for one file). Support for modern CSS runtime things like |
@alex-r-bigelow ( 👋 ) can you give us a concrete example of where this
is hitting you? It's hard for us to consider improvements without a concrete situation to consider. |
Sorry for the delay; admittedly, I'm still a fairly casual / semi-new Quarto user, so it's taken a moment to identify the right words. I'm including a way-too-detailed dump to help communicate the concrete situation of where/how I got stuck, but TL;DR:
If this is way too much information, not enough information, something is confusing, and/or a helper* would be useful for any of this ... I'm always happy to meet up or hop on a call. * Ugh, sorry for the unsolicited ad. but in case it's relevant: I'm still an under-employed vis freelancer... 1. Where I Went WrongAn example that sent me down a bad path: trying to set these two things at the same time:
Attempting to follow the HTML Theming docs—where Google landed me first [2]—step-by-step, I ended up creating this mess:
|
Description
I'm suggesting that it could be useful to map a few additional CSS variables from Yaml to the CSS
:root
variables. Currently, there are already some variables defined such as:and, for example, the document's fontcolor, monofont, linkcolor, etc, can be set in the Yaml. I believe it would be useful to add a couple of such mappings, for example to define a "accent" / "highlighting" colour, as a minimal theming system. It's common for a document to have one main colour (black font), and another colour for titles, buttons, etc. This kind of logic is used in other systems, such as Beamer themes or ggplot2 themes. Colour palettes can even be derived from this parent element by CSS transformations, e.g.
to create a semi-transparent, lighter shade.
I'm not sure how many of these mappings might make sense – presumably just very few, otherwise it'll get too complicated to follow the possible interactions between Bootstrap and (S)CSS variables.
The text was updated successfully, but these errors were encountered: