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?
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.
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.
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.
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.
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)
```
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With