R/add_theme.R

Defines functions add_theme

Documented in add_theme

#' Add a bootswatch color theme to an app 
#'
#' @param theme \code{character} A bootswatch theme name (see details)
#' @details This function should not be called directly but is invoked when an 
#'          app is rendered.
#'          
#'          Themes are provided by calling \code{shinythemes::shinytheme}, 
#'          therefore available theme names are those provided by the 
#'          \code{shinythemes} package.  By default, \code{theme = 'flatly'}
#' @importFrom shinythemes shinytheme
#' @importFrom shiny getShinyOption
#' 
#' @export
add_theme <- function(theme = NULL)
{
    if(is.null(theme) && is.null(getShinyOption("theme"))) {
      
      return(shinythemes::shinytheme(theme = 'flatly'))
      
    } else {
      
      return(shinythemes::shinytheme(theme = theme))
      
    }
}
Auburngrads/teachingApps documentation built on June 17, 2020, 4:57 a.m.