View source: R/bs-current-theme.R
bs_current_theme | R Documentation |
Intended for advanced use by developers to obtain the currently active theme
at render time and primarily for implementing themable widgets that can't
otherwise be themed via bs_dependency_defer()
.
bs_current_theme(session = get_current_session(FALSE))
session |
The current Shiny session (if any). |
This function should generally only be called at print/render time. For example:
Inside the preRenderHook
of htmlwidgets::createWidget()
.
Inside of a custom print method that generates htmltools::tags.
Inside of a htmltools::tagFunction()
Calling this function at print/render time is important because it does different things based on the context in which it's called:
If a reactive context is active, session$getCurrentTheme()
is called
(which is a reactive read).
If no reactive context is active, shiny::getCurrentTheme()
is called
(which returns the current app's theme
, if relevant).
If shiny::getCurrentTheme()
comes up empty, then bs_global_get()
is called, which is relevant for rmarkdown::html_document()
, and
possibly other static rendering contexts.
Returns a bs_theme()
object.
Other Bootstrap theme functions:
bs_add_variables()
,
bs_dependency()
,
bs_global_theme()
,
bs_remove()
,
bs_theme()
,
bs_theme_dependencies()
,
bs_theme_preview()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.