Title Area Border Color
Btibert3 opened this issue Β· comments
I want to qualify that I am very new and am only now finding the time to start to wrap my head around xaringan and the ability to write my lecture slide decks in R Markdown. Also, I have very little experience editing CSS. π
That said, I love where you are going with this package and have more of a feature request really. One of the things that I like about the metropolis theme is the shaded title area. This would let me stay on brand for my institution.
Is it possible to add that as a modifiable attribute in your theme functions and customization? From the theme (and color modified by me), it appears that this is the area of the CSS that drives that.
.remark-slide-content {
background-color: #FAFAFA;
border-top: 80px solid #CC0000;
font-size: 20px;
font-weight: 300;
line-height: 1.5;
padding: 1em 2em 1em 2em
}
I dont know if it would be possible to have two additional arguments for the theme; border-top
and border-color
, something like that?
Thanks again for this awesome package. It appears that there is much to be excited about in future releases!
Thanks for the suggestion! This is a great idea and would be a great addition to this package. Will definitely add, hopefully I'll get some time soon.
Hi @Btibert3, sorry it took so long, but I think I have a solution for you -- or at least one that's ready for some testing.
I've added an option header_background_enable
to the theme functions that, when set to TRUE
, enables a background under h1
headers (first level, or single #
). The color is automatically decided by the theme, but can be customized using header_background_color
for the background bar and header_background_text_color
for the header text color.
Here's an example using duo_accent()
:
```{r xaringanthemer, include=FALSE}
duo_accent(header_background_enable = TRUE)
```
---
# Hello World
Install the **xaringan** package from [Github](https://github.com/yihui/xaringan):
The bar is only created for level 1 headers (like above) and only when the slide classes do not include normal
, inverse
, title
, middle
or bottom
. Note that normal
isn't a defined class in remark/xaringan, but I added it so that you can suppress the header bar if needed.
To test it out, install the dev
branch of xaringanthemer and please let me know how it works for you!
# install.packages("remotes")
remotes::install_github("gadenbuie/xaringanthemer@dev")
Awesome, let me check this out!
I just changed the key argument to header_background_auto
instead of header_background_enable
. With the new behavior, you can still add a background to the h1
header elements if header_background_auto = FALSE
by using
class: header_background
to manually enable the background title bar on a slide-by-slide basis. Setting header_background_auto = TRUE
will automatically add the title bar to slides as previously described.
I finally merged this into master, sorry that it took me so long!