R/Untitled.R

library(shinyWidgets)

if (interactive()) {
  
  ### Uniform color background :
  
  library(shiny)
  library(shinyWidgets)
  
  ui <- fluidPage(
    tags$h2("Change shiny app background"),
    setBackgroundColor("ghostwhite")
  )
  
  server <- function(input, output, session) {
    
  }
  
  shinyApp(ui, server)
  
  
  ### linear gradient background :
  
  library(shiny)
  library(shinyWidgets)
  
  ui <- fluidPage(
    
    # use a gradient in background
    setBackgroundColor(
      color = c("#F7FBFF", "#2171B5"),
      gradient = "linear",
      direction = "bottom"
    ),
    
    titlePanel("Hello Shiny!"),
    sidebarLayout(
      sidebarPanel(
        sliderInput("obs",
                    "Number of observations:",
                    min = 0,
                    max = 1000,
                    value = 500)
      ),
      mainPanel(
        plotOutput("distPlot")
      )
    )
  )
  
  server <- function(input, output, session) {
    output$distPlot <- renderPlot({
      hist(rnorm(input$obs))
    })
  }
  
  shinyApp(ui, server)
  
  
  ### radial gradient background :
  
  library(shiny)
  library(shinyWidgets)
  
  ui <- fluidPage(
    
    # use a gradient in background
    setBackgroundColor(
      color = c("#F7FBFF", "#2171B5"),
      gradient = "radial",
      direction = c("top", "left")
    ),
    
    titlePanel("Hello Shiny!"),
    sidebarLayout(
      sidebarPanel(
        sliderInput("obs",
                    "Number of observations:",
                    min = 0,
                    max = 1000,
                    value = 500)
      ),
      mainPanel(
        plotOutput("distPlot")
      )
    )
  )
  
  server <- function(input, output, session) {
    output$distPlot <- renderPlot({
      hist(rnorm(input$obs))
    })
  }
  
  shinyApp(ui, server)
  
}
danielmartincruz/crisapp documentation built on Jan. 1, 2021, 2:50 p.m.