r-lib / asciicast

Turn R scripts into terminal screencasts
https://asciicast.r-lib.org/
Other
226 stars 11 forks source link

Control theme/font size in init_knitr_engine #29

Closed hadley closed 2 years ago

hadley commented 2 years ago

On https://waldo.r-lib.org, the font size looks a little too small, and the dark theme looks out of place.

gaborcsardi commented 2 years ago

Unfortunately this look rather tricky, because AFAICT the font size depends on how wide the image is on the page. So if you set the number of columns in asciicast to a smaller number, you'll probably get a bigger font size.

But I am not sure how we could match the font size to the HTML font size.

gaborcsardi commented 2 years ago

@hadley As for the themes, we have SVG themes now, and there is a github-light theme, which look appropriate for the waldo pkgdown:

You need to add this after the init_knitr_engine() call, in the same chunk:

options(asciicast_theme = "github-light")
gaborcsardi commented 2 years ago

We could also have an engine that creates HTML instead of an SVG, and then we could use that on pkgdown sites, when we don't need animations.

gaborcsardi commented 2 years ago

There is also a "pkgdown" theme now, it looks OK with asciicast_cols = 80: https://callr.r-lib.org/articles/r-session.html

(The background color is still slightly different, IDK why. They are literally the same RGB colors. Maybe the SVG has some filter or something.)

In any case, I'll close this now. #33 will be a better solution, once we have that we'll only need SVGs or GIFs for actual animations. And in GH READMEs of course.