title: Dynamic color input in shiny server
body: <p>I am trying to create an app using Shiny, where I want the user to be able to select the color of each line in a plot. The general idea is to import the data in the app and then plot each variable in the data. I tried to use the colorpicker 'jscolorInput' from the shinysky package, which works fine when placed in the ui.r file, but since I want my app to be dynamic for each dataset uploaded, I need to put the colorpicker in the server.R, using a reactive function. 
  When placed in the server, the 'jscolorInput' does not work. </p>
  
  <p>What I want to do is: </p>
  
  <ol>
  <li>Reproduce the colorpicker as many times as the number of
  variables in the data </li>
  <li>Take the input from the color and pass it
  as color argument in the plot</li>
  </ol>
  
  <p>I am very new in both shiny development and stackoverflow, so please excuse my mistakes. </p>
  
  <p>Here is a reproducible example that does not work. </p>
  
  <pre><code>require(shinysky)
  require(shiny)
  
  dat &lt;- data.frame(matrix(rnorm(120, 2, 3), ncol=3))
  
  runApp(list(
  ui = bootstrapPage(
      # The reactive colorpicker
      uiOutput('myPanel'),
      # The plot
      plotOutput('plot')
  ),
  server = function(input, output) {
      # Print as many colorpickers as the columns in the dataset
      cols &lt;- reactive({
          n &lt;- ncol(dat)
          for(i in 1:n){
              print(jscolorInput(paste("col", i, sep="_")))    
          }
      })
  
          output$myPanel &lt;- renderPrint({cols()})
      # Put all the input in a vector
      colors &lt;- reactive({
          n &lt;- ncol(dat)
          lapply(1:n, function(i) {
              input[[paste("col", i, sep="_")]]
          })
      })
  
      output$plot &lt;- renderPlot({
          cols &lt;- ifelse(is.null(input$col_1), rep("000000 ", n), colors()) 
          plot(dat[,1], col= paste0("#", cols[1], ""))
                                  for(i in 2:ncol(dat))lines(dat[,i], col=cols[i])
      })
  
  }
  ))
  </code></pre>