Description Usage Arguments Value Examples
Implement a default dark/light toggle mode that will be triggered by any shiny element. The user can also define other colors to work with.
1 2 3 4 5 6 7 | nightly(
trigElement,
bodyColor = "#282828",
txtColor = "#f5f5f5",
inpTxtColor = "#f5f5f5",
inpBgColor = "#313131"
)
|
trigElement |
the id of the shiny element that will trigger the toggle mode |
bodyColor |
the color of the application's body after clicking on the trigElement. Defaults to #282828 (dark) |
txtColor |
the color of the text within the application after clicking on the trigElement. Defaults to #f5f5f5 (white) |
inpTxtColor |
the color of the text within the shiny inputs after clicking on the trigElement. Defaults to #f5f5f5 (white) |
inpBgColor |
the color of the background of the shiny inputs after clicking on the trigElement. Defaults to #313131 (Very Dark Grey) |
A default dark/light toggle mode in shiny ui
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | if (interactive()) {
ui <- fluidPage(
use_nightly(),
h1("Click on the Plot to Toggle a Dark/Light Mode in you Shiny Application"),
plotOutput(outputId = "plt1"),
nightly(trigElement = "plt1")
)
server <- function(input, output) {
output$plt1 <- renderPlot({
plot(mtcars)
})
}
shinyApp(ui = ui, server = server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.