library(dplyr) library(purrr) knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
In order to use a standardised set of box colours, we defined the following box types:
bs2site:::get_box_colours() %>% select(name, description) %>% knitr::kable()
To generate the above described box colours, just add the class: ### Header {.box-4 .intro}
draw_box <- function(colour, outline = FALSE) { htmltools::h3("Header") %>% htmltools::div(class = glue::glue("box {colour} {if_else(outline, 'outline', '')}"), "Some text using", htmltools::br(), htmltools::code(paste0(colour, if_else(outline, ' outline', ''))) ) }
colours <- pull(bs2site:::get_box_colours(), name) purrr::map(colours, draw_box) %>% htmltools::div(class = "box-container") %>% htmltools::doRenderTags()
Outline boxes exhibit a white background and only use the header/border colour. Just add the .outline
class to your box (e.g. ### Header {.box-4 .intro .outline}
)
purrr::map(colours, draw_box, outline = TRUE) %>% htmltools::div(class = "box-container") %>% htmltools::doRenderTags()
The colours are defined in a css
file. I you're using a site configured as expected by the bs2site
package, simply run the use_box_colours()
function to create (or update) the file. A link to the css file is automatically added to the lectures/_output.yml
file.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.