Created
October 3, 2018 17:47
-
-
Save zappingseb/83f0972a4a0c964e9bb5d76d0d42ae2b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Try to remove the input Handler as shiny does not allow double input | |
# handlers | |
try({ removeInputHandler("DoubleColorPickerBinding") }) | |
# Use the shiny registerInputHandler function to | |
# register a way to deal with the inputs coming | |
shiny::registerInputHandler( | |
"DoubleColorPickerBinding", | |
function(x, shinysession, name) { | |
if(is.null(x)) { | |
return(x) | |
} else { | |
# Parse return value from JSON into R format dataframe | |
colors_df <- jsonlite::fromJSON(x) | |
# Extract the values of the data frame as a list | |
res <- list() | |
res[["fill"]] <- colors_df$value[ | |
which(grepl(colors_df$name,pattern="fill")) | |
] | |
res[["border"]] <- colors_df$value[ | |
which(grepl(colors_df$name,pattern="border")) | |
] | |
return(res) | |
} | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment