Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the color/theme on rmdformats/readthedown?

Tags:

markdown

r

I'm generating a report using the rmdformats package in R, with the readthedown format.

How can I change the default overall color?

enter image description here

like image 990
Dan Avatar asked Mar 21 '17 18:03

Dan


3 Answers

rmdformats author here.

To change the default color for titles and other elements, you have to provide a custom CSS file which redefines the default CSS elements defining color.

If think the following CSS elements should be enough :

#main .nav-pills > li.active > a,
#main .nav-pills > li.active > a:hover,
#main .nav-pills > li.active > a:focus {
    background-color: #22983B;
}

#main .nav-pills > li > a:hover {
    background-color: #22983B;
}

h1, h2, h3, h4, h5, h6, legend {
    color: #22983B;
}

#nav-top span.glyphicon {
    color: #22983B;
}

#table-of-contents header {
    color: #22983B;
}

#table-of-contents h2 {
    background-color: #22983B;
}

#main a {
    background-image: linear-gradient(180deg,#d64a70,#d64a70);
    color: #c7254e;
}

a:hover {
    color: #3d1308;
}

a:visited {
    color: #3d1308;
}

Customize and add this to a custom.css file in your Rmd file directory, and add css: custom.css in your preamble.

like image 107
juba Avatar answered Nov 18 '22 22:11

juba


If you don't want a separate .css file, you can also add elements in the Rmd file between style tags, e.g., outside of a chunk, near the top:

<style>
p {
    font-size: 16px;
    line-height: 24px;
    margin: 0px 0px 12px 0px;
}

h1, h2, h3, h4, h5, h6, legend {
    font-family: Arial, sans-serif;
    font-weight: 700;
    color: #9F2042;
}
</style>
like image 25
daaronr Avatar answered Nov 18 '22 21:11

daaronr


@csmontt

add this to juba's example. Also, inspecting the knitted document will help you greatly on how to target specific aspects.

#table-of-contents {
color:orange;
background: grey !important; 
}
like image 5
Jorge Avatar answered Nov 18 '22 22:11

Jorge