gadenbuie / xaringanthemer

😎 Give your xaringan slides some style
https://pkg.garrickadenbuie.com/xaringanthemer/
Other
445 stars 28 forks source link

Title Area Border Color #10

Closed Btibert3 closed 4 years ago

Btibert3 commented 5 years ago

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!

gadenbuie commented 5 years ago

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.

gadenbuie commented 5 years ago

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:


![Screenshot_2019-03-09 Presentation Ninja](https://user-images.githubusercontent.com/5420529/54075767-173b2300-4271-11e9-8131-f59f8a23b8b7.png)

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!

```r
# install.packages("remotes")
remotes::install_github("gadenbuie/xaringanthemer@dev")
Btibert3 commented 5 years ago

Awesome, let me check this out!

gadenbuie commented 5 years ago

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.

gadenbuie commented 4 years ago

I finally merged this into master, sorry that it took me so long!