Here, I describe how you can achieve this behavior using my custom pkgdown template, preferably, and sfthemes. Source: vignettes/auto. You need a set of light/dark theme, and a collection of compatible, and optimized color scales in order to be able to deliver a seamless experience. theme specifies the Bootstrap theme to use for the page (themes are drawn from the Bootswatch theme library). While changing the text and background color can be “easily” adjusted using CSS, creating two similar, compatible, and optimized plots for light and dark appearances is not straightforward. For instance, as you can see below, a light themed plot is used in the light version of the website, and a dark themed plot in the dark version. Customization & Configuration Now that you have a document ready to go, you’ll want to customize it to make it look the way you want. Fortunately, it is possible to provide two versions of a same image and inform browsers on when to use one instead of the other. ![]() However, background and text colors are not the only elements of a website that should be adjust based on users’ preferences, figures and plots should adapt their appearances as well. Recently, I developed preferably to take advantages of this, and customize pkgdown websites based on user’s preferred system appearances, e.g., light/dark mode. If your graphics device is postscript, we recommend that you disable this feature (see more info in the knitr issue #1365).įig_caption controls whether figures are rendered with captions (this is true by default).ĭev controls the graphics device used to render figures (defaults to pdf).Nowadays, most modern web browsers can detect users system preferences and notify a website to deliver an accessible and customized experience to the visitors. For macOS users who have installed Homebrew, ghostscript can be installed via brew install ghostscript. ![]() You also have to make sure the system package ghostscript is available in your system for pdfcrop to work. If you are using TinyTeX as your LaTeX distribution, we recommend that you run tinytex::tlmgr_install("pdfcrop") to install the LaTeX package pdfcrop. RMarkdown is a great way to record your work, allowing you to write a narrative and capture your code all in one place. Optionally hide your code in R Markdown with codefolding. There are two ways to set the output of a document: Permanently, by modifying the YAML header: title: 'Viridis Demo' output: htmldocument Transiently, by calling rmarkdown::render () by hand: rmarkdown:: render ('diamond-sizes.Rmd', outputformat 'worddocument') This is useful if you want to programmatically produce multiple types of output. hugo-future-imperfect and hugo-statnmap-theme are multilingual themes allowing for. There are a number of options that affect the output of figures within PDF documents:įig_width and fig_height can be used to control the default figure width and height (6.5x4.5 is used by default).įig_crop controls whether the pdfcrop utility, if available in your system, is automatically applied to PDF figures (this is true by default). title: 'My doc' author: 'Me' date: Joutput: prettydoc::htmlpretty: theme: architect highlight: github-More on prettydoc here. I modified two Hugo themes to be able to share R code using blogdown. ![]()
0 Comments
Leave a Reply. |