Title: | A Wrapper of the 'JavaScript' Library 'Nightly' |
---|---|
Description: | Allows the user to implement a dark/light toggle mode in 'shiny' using the 'Nightly' 'JavaScript' library. The default mode is dark/light however the user can also specify other colours. |
Authors: | Mohamed El Fodil Ihaddaden [aut, cre], Abdeldjalil Fortas [ctb, cph] (nightly.js library developer) |
Maintainer: | Mohamed El Fodil Ihaddaden <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-11-21 02:48:22 UTC |
Source: | https://github.com/feddelegrand7/rnightly |
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.
nightly( trigElement, bodyColor = "#282828", txtColor = "#f5f5f5", inpTxtColor = "#f5f5f5", inpBgColor = "#313131" )
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
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) }
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) }
The function activates the capabilities of the nightly javascript library. The user can put it anywhere within the UI.
use_nightly()
use_nightly()
called for the side effect of activating the scrollrevealjs library
# Put the function within your shiny ui use_nightly()
# Put the function within your shiny ui use_nightly()