Provides a cleanrmd CSS theme using htmltools. You can use this
CSS theme anywhere that HTML dependencies are handled via
htmltools::htmlDependency(), for example in R Markdown or Quarto documents
or in Shiny apps.
use_cleanrmd(name = NULL)
cleanrmd_theme_dependency(name = NULL)The name of the theme, see cleanrmd_themes() for a list of
available themes. If NULL, all themes will be loaded with a simple
drop down theme picker.
use_cleanrmd() returns an htmltools::tagList() with an
htmltools::htmlDependency(). cleanrmd_theme_dependency() returns only
the htmltools::htmlDependency().
use_cleanrmd(): Use a clean CSS theme in the current document or app
(general usage)
cleanrmd_theme_dependency(): Use a clean CSS theme dependency (advanced usage)
In R Markdown (static or Shiny
prerendered), you should use the html_document_clean() output format to
use a cleanrmd theme.
You can also use cleanrmd in Quarto documents
or apps (using server: shiny). You'll need to turn off the themes
provided by Quarto with theme: none and then call
cleanrmd::use_cleanrmd() in a code chunk in your document.
In Shiny apps, you'll need to use shiny::basicPage() rather than
shiny::fluidPage(). Then call use_cleanrmd() in your app to use a
cleanrmd theme.
library(shiny)
ui <- shiny::basicPage(
cleanrmd::use_cleanrmd(),
h2("Old Faithful Geyser Data"),
sliderInput(
"bins",
"Number of bins:",
min = 1,
max = 50,
value = 30
),
plotOutput("distPlot")
)page <- htmltools::withTags(
main(
h2("Small Demo"),
p("Clean, simple, classy but class-less:"),
ul(
li("Works almost anywhere"),
li("Small and simple"),
li("Easy to extend"),
li("Good enough but not perfect")
)
)
)
# no styles
if (interactive()) {
htmltools::browsable(page)
}
# all clean styles
page_clean <- htmltools::tagList(page, use_cleanrmd())
if (interactive()) {
htmltools::browsable(page_clean)
}
# one clean style
page_water <- htmltools::tagList(page, use_cleanrmd("water"))
if (interactive()) {
htmltools::browsable(page_water)
}
cleanrmd_theme_dependency("bamboo")
#> List of 10
#> $ name : chr "cleanrmd"
#> $ version : chr "0.1.1"
#> $ src :List of 1
#> ..$ file: chr "resources/bamboo"
#> $ meta : NULL
#> $ script : NULL
#> $ stylesheet: chr "bamboo.css"
#> $ head : NULL
#> $ attachment: NULL
#> $ package : chr "cleanrmd"
#> $ all_files : logi TRUE
#> - attr(*, "class")= chr "html_dependency"