Change the header color of the "Material" theme of the "rmdformats" package to an html output in Rmarkdown

Asked

Viewed 212 times

3

I would like to change the header color of the "Material" theme of the "rmdformats" package to an html output of rmarkdown.

I want to change from green to blue just the header, keeping all other structures and colors

I’m having trouble finding the solution

---
title: "Sample document"
output:
  rmdformats::material:
    highlight: kate
    self_contained: false
    thumbnails: true
    gallery: true
    fig_width: 11
    fig_height: 6
    df_print: kable
runtime: shiny


---



```{r, echo=FALSE}

library(DT)


datatable(
  iris, extensions = 'Buttons', options = list(
    dom = 'Bfrtip',
    buttons = c('copy', 'csv', 'excel', 'pdf', 'print','colvis')
  )
)


```

1 answer

4


You can include a CSS Chunk in the body of the file . Rmd, to define the visual attributes of the page HTML elements that is generated.

In this specific case, you need to include, in this Chunk CSS, a selector that identifies the header, and then set the desired background color through the property background-color. A possible selector would be div.header-panel.

So include the below Chunk should achieve the desired result:

div.header-panel {
   background-color: blue;
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.