In Rstudio rmarkdown, how to add new html themes from Bootswatch?

Hello,

I'm building a rmarkdown file and trying to do the following

---
title: "test"
author: "test" 
output: 
    html_document:
        toc: true
        toc_float: true
        theme: solar
---

And i got the following error:

rror in match.arg(theme, themes()) : 
  'arg' should be one of "default", "cerulean", "journal", "flatly", "readable", "spacelab", "united", "cosmo", "lumen", "paper", "sandstone", "simplex", "yeti"
Calls: <Anonymous> -> <Anonymous> -> base -> match.arg

How could i add new themes?

Right now themes for rmarkdown is still using bootstrap 3.3.7. You may consider using this bootswatch 3 page for references.

I think i found the solution

  1. Download bootstrap.css file from https://bootswatch.com/
  2. Put the bootstrap.css file in the same folder with your rmd file.
  3. Change rmd code to this
title: "test"
author: "test" 
output: 
    html_document:
        css: bootstrap.css
1 Like

Hi there! If your question's been answered (even by yourself!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here's how to do it.

1 Like

Thanks for the reminder.

Thanks for the solutions rather you can build your own HTML using these bootstrap components