Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xaringan slides advance with odd latency in presentation

I am presenting my slides (same problem in in RStudio as in browser) and the transitions have weird latency. New text comes in, but old text doesn't go away for more than 0.5 sec.

I have a video on YouTube that illustrates the problem.

Not really sure where the problem stems from. Any suggestions?

like image 337
Lars Hinrichs Avatar asked Nov 25 '25 10:11

Lars Hinrichs


1 Answers

The issue arises from a mismatch between R's color names and HTML/CSS color names. Here is the source code chunk used in the slides to create the xaringanthemer CSS:

```{r xaringan-themer, include=FALSE, warning=FALSE}
library(xaringanthemer)
style_xaringan(title_slide_background_image = "https://wallpapercave.com/wp/wp2567196.jpg",
               background_color = "grey14",
               title_slide_text_color = "white"
               )
```

Unfortunately "grey14" is an R color, but it's not recognized by HTML, so the slide background becomes transparent. A warning is emitted that hexadecimal colors are expected if used by theme_xaringan(), so I understand why the warning was ignored.

In some cases, the color names are the same — e.g. "white" is both an R and HTML color — so it made sense to me to warn rather than throw an error in cases like these.

You can use col2rgb() to lookup the rgb or hex representation of the color:

col2rgb("grey14")
#>       [,1]
#> red     36
#> green   36
#> blue    36
rgb(36, 36, 36, maxColorValue = 255)
#> [1] "#242424"

So either background_color="#242424" or background_color = "rgb(36,36,36)" would create slides with a solid background.

like image 64
grrrck Avatar answered Nov 26 '25 23:11

grrrck



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!