Build dark-mode variants of several figures at once, dispatching on the file
extension: SVG files are inverted with invert_svg() and PNG files with
invert_png(). Every output is written next to its input, or into
output_dir, with a -dark suffix added to the name. Files that already
carry the suffix are skipped, so running the function twice does not
complement the dark variants again.
Arguments
- path
Path(s) to figure files, or to directories holding them.
- output_dir
Directory the dark variants are written to. Default is next to each input file.
- suffix
Suffix added to the file name of every dark variant. Default is
-dark.- recursive
Whether a directory is scanned recursively. Default is
FALSE.- quiet
Whether to suppress the per-file messages. Default is
FALSE.
Details
Other formats are not supported: there is no way to rewrite the colours of a
PDF from R without rasterising it first. Re-render the figure as SVG or PNG
where possible, for instance with ggsave(), or rasterise the PDF before
inverting it. Unsupported files are only reported when they are passed as a
file; a directory is scanned for the supported extensions.