diff --git a/R/blastula_email_format.R b/R/blastula_email_format.R index a3d9ef7c..59f50e73 100644 --- a/R/blastula_email_format.R +++ b/R/blastula_email_format.R @@ -38,6 +38,9 @@ #' default definition or R Markdown. #' @param connect_footer Should a prepared footer message with links be included #' in the rendered email? +#' @param background_color The color to use for the e-mail's background. You +#' can provide any valid color specification supported by the +#' [`background-color` CSS property](https://developer.mozilla.org/docs/Web/CSS/background-color). #' @param ... Specify other options in [rmarkdown::html_document()]. #' #' @export @@ -58,13 +61,15 @@ blastula_email <- function(toc = FALSE, keep_md = FALSE, md_extensions = NULL, connect_footer = FALSE, + background_color = "#f6f6f6", ...) { if (template == "blastula") { template <- system.file("rmd", "template.html", package = "blastula") } - pandoc_args <- NULL + pandoc_args <- paste0("--variable=background-color:", background_color) + if (isTRUE(connect_footer)) { pandoc_args <- c( pandoc_args, diff --git a/R/bls_template.R b/R/bls_template.R index e459682d..74cde457 100644 --- a/R/bls_template.R +++ b/R/bls_template.R @@ -149,8 +149,8 @@ bls_standard_template <- function() { - - + +
  diff --git a/R/compose_email.R b/R/compose_email.R index daef87e3..1633a393 100644 --- a/R/compose_email.R +++ b/R/compose_email.R @@ -13,6 +13,9 @@ #' in `...`. Alternatively, we can supply a set of `block_*()` calls enclosed #' within the [blocks()] function to take advantage of precomposed HTML #' blocks. +#' @param background_color The color to use for the e-mail's background. You +#' can provide any valid color specification supported by the +#' [`background-color` CSS property](https://developer.mozilla.org/docs/Web/CSS/background-color). #' @param .title The title of the email message. This is not the subject but the #' HTML title text which may appear in limited circumstances. #' @param .envir An opportunity to specify the environment. By default, this is @@ -70,6 +73,7 @@ compose_email <- function(body = NULL, header = NULL, footer = NULL, + background_color = "#f6f6f6", .title = NULL, .envir = parent.frame(), ...) { diff --git a/inst/rmd/template.html b/inst/rmd/template.html index ed07d742..fc36db7b 100644 --- a/inst/rmd/template.html +++ b/inst/rmd/template.html @@ -79,8 +79,8 @@ } - - + +
  diff --git a/man/blastula_email.Rd b/man/blastula_email.Rd index 4bb8b77d..e2b98da6 100644 --- a/man/blastula_email.Rd +++ b/man/blastula_email.Rd @@ -9,7 +9,7 @@ blastula_email(toc = FALSE, toc_depth = 3, toc_float = FALSE, fig_height = 5, fig_retina = 2, fig_caption = TRUE, dev = "png", smart = TRUE, self_contained = TRUE, template = "blastula", includes = NULL, keep_md = FALSE, md_extensions = NULL, - connect_footer = FALSE, ...) + connect_footer = FALSE, background_color = "#f6f6f6", ...) } \arguments{ \item{toc}{If you would like an automatically-generated table of contents in @@ -66,6 +66,10 @@ default definition or R Markdown.} \item{connect_footer}{Should a prepared footer message with links be included in the rendered email?} +\item{background_color}{The color to use for the e-mail's background. You +can provide any valid color specification supported by the +\href{https://developer.mozilla.org/docs/Web/CSS/background-color}{background-color CSS property}.} + \item{...}{Specify other options in \code{\link[rmarkdown:html_document]{rmarkdown::html_document()}}.} } \description{ diff --git a/man/compose_email.Rd b/man/compose_email.Rd index 3d9c9b25..1a650357 100644 --- a/man/compose_email.Rd +++ b/man/compose_email.Rd @@ -5,7 +5,8 @@ \title{Create the email message body} \usage{ compose_email(body = NULL, header = NULL, footer = NULL, - .title = NULL, .envir = parent.frame(), ...) + background_color = "#f6f6f6", .title = NULL, + .envir = parent.frame(), ...) } \arguments{ \item{header, body, footer}{The three layout sections for an email message @@ -15,6 +16,10 @@ in \code{...}. Alternatively, we can supply a set of \code{block_*()} calls encl within the \code{\link[=blocks]{blocks()}} function to take advantage of precomposed HTML blocks.} +\item{background_color}{The color to use for the e-mail's background. You +can provide any valid color specification supported by the +\href{https://developer.mozilla.org/docs/Web/CSS/background-color}{background-color CSS property}.} + \item{.title}{The title of the email message. This is not the subject but the HTML title text which may appear in limited circumstances.}