inst/shiny/server.r

library(shiny)
library(ggplot2)
library(highlightHTML)

shinyServer(function(input, output) {
  
  # compile red, green, and blue inputs into a vector
  dataInput <- reactive({
    c(input$red, input$green, input$blue) 
  })
  datasetP <- data.frame(x = c(0), y = c(0))
  
  output$hex <- renderPrint({
    rgbCode <- dataInput()
    hex <- rgb2hex(rgbcode = list(rgbCode))
    hex2 <- paste("#", hex$HexCodes, sep = "")
    print(hex2)
  })
  
  output$color_plot <- renderPlot({
    rgbCode <- dataInput()
    hex <- rgb2hex(rgbcode = list(rgbCode))
    hex2 <- paste("#", hex$HexCodes, sep = "")
    p <- ggplot(datasetP, aes(x = x, y = y)) + 
      geom_point(color = hex2, size = 1000) + theme_bw() +
      theme(line = element_blank(), text = element_blank(),
            rect = element_blank())
    print(p)
  })
  
})

Try the highlightHTML package in your browser

Any scripts or data that you put into this service are public.

highlightHTML documentation built on April 21, 2020, 5:06 p.m.