Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I edit bootstrap theme in rmarkdown?

I am currently using the cosmo theme in rmarkdown. If I want to change the color of my navigation menu, or, more specifically, the menu highlight, which file should I edit?

like image 909
Jim O. Avatar asked May 25 '17 19:05

Jim O.


People also ask

How do I work with a bootstrap theme?

There are two primary strategies for working with your theme. Working with source files showcases how powerful Bootstrap themes can be and the underlying design systems. It allows you to use powerful features like SCSS variables to change a theme’s entire color scheme or type system by swapping a few variable values.

What is R Markdown theme Gallery?

R Markdown Theme Gallery R Markdown is a great way to integrate R code into a document. An example of the default theme used in R Markdown HTML documents is shown below.

How do I use R Markdown with shiny?

For example, most Shiny page layout functions (e.g., shiny::navbarPage ()) and some popular R Markdown formats (e.g., rmarkdown::html_document) all have a theme parameter. To use bslib in Shiny, provide a bs_theme () object to the theme parameter; and in R Markdown, provide bs_theme () parameters to theme.

How to control the appearance of HTML documents in Bootstrap?

There are several options that control the appearance of HTML documents: theme specifies the Bootstrap theme to use for the page (themes are drawn from the Bootswatch theme library). Valid themes include default, cerulean, journal, flatly, darkly, readable, spacelab, united, cosmo, lumen, paper, sandstone, simplex, and yeti.


Video Answer


1 Answers

If you really want to change the cosmos CSS you can find it here: [path to libraries]/rmarkdown/rmd/h/bootstrap-3.3.5/css/cosmo.min.css However if I only need to change one thing, I usually just put the CSS into the markdown document as in the following example.

You can also attach your own CSS as documented here: http://rmarkdown.rstudio.com/html_document_format.html#custom_css

---
title: "Untitled"
author: "Ian Wesley"
date: "May 25, 2017"
output: 
  html_document:
    theme: cosmo

---

<style>
  h2{
    font-size: 50px !important;
    color: crimson !important
  }
</style>

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

```{r cars}
summary(cars)
```

## Including Plots

You can also embed plots, for example:

```{r pressure, echo=FALSE}
plot(pressure)
```
like image 80
Ian Wesley Avatar answered Oct 06 '22 02:10

Ian Wesley