Quellcode durchsuchen

requires_xaringanthemer_env() doesn't have to check for theme elements

tags/v0.3.0
Garrick Aden-Buie vor 6 Jahren
Ursprung
Commit
8392cf653f
1 geänderte Dateien mit 9 neuen und 3 gelöschten Zeilen
  1. +9
    -3
      R/ggplot2.R

+ 9
- 3
R/ggplot2.R Datei anzeigen

#' @export #' @export
theme_xaringan_restore_defaults <- function() { theme_xaringan_restore_defaults <- function() {
requires_package("ggplot2") requires_package("ggplot2")
requires_xaringanthemer_env()
requires_xaringanthemer_env(try_css = FALSE, requires_theme = FALSE)


if (is.null(xaringanthemer_env$old_ggplot_defaults)) { if (is.null(xaringanthemer_env$old_ggplot_defaults)) {
return(invisible()) return(invisible())
invisible(TRUE) invisible(TRUE)
} }


requires_xaringanthemer_env <- function(css_file = NULL, try_css = TRUE) {
requires_xaringanthemer_env <- function(
css_file = NULL,
try_css = TRUE,
requires_theme = TRUE
) {
reload <- !is.null(css_file) && isTRUE(try_css) reload <- !is.null(css_file) && isTRUE(try_css)
if (reload || !exists("xaringanthemer_env") || is.null(xaringanthemer_env$header_color)) {
pkg_env_exists <- exists("xaringanthemer_env")
missing_theme <- requires_theme && pkg_env_exists && is.null(xaringanthemer_env$header_color)
if (reload || !pkg_env_exists || missing_theme) {
if (try_css) { if (try_css) {
css_vars <- read_css_vars(css_file) css_vars <- read_css_vars(css_file)
for (css_var in names(css_vars)) { for (css_var in names(css_vars)) {

Laden…
Abbrechen
Speichern