Skip to content

Commit

Permalink
allow color to be passed as name
Browse files Browse the repository at this point in the history
  • Loading branch information
hypebright committed Apr 28, 2024
1 parent 519466e commit db8d0c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions R/update-app.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
#'
#' @export
updateF7App <- function(options, session = shiny::getDefaultReactiveDomain()) {

# if color in options, convert color to hex
if (!is.null(options$color)) {
if (options$color %in% getF7Colors()) {
options$color <- colorToHex(options$color)
}
}

sendCustomMessage("update-app", options, session)
}

Expand Down
5 changes: 3 additions & 2 deletions vignettes/update-app.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,10 @@ shinyApp(
}
)
```
TODO: shinylive example

Note that the given `color` should be a valid hexadecimal color. You can call `updateF7App` multiple times, and the app will update the given configuration settings accordingly.
Note that the color can both be a color of `getF7Colors()` (like "primary", "pink" or "teal") or a hexadecimal color. You can call `updateF7App` multiple times, and the app will update the given configuration settings accordingly.

TODO: shinylive example

### Updating component configuration

Expand Down

0 comments on commit db8d0c7

Please sign in to comment.