I'm generating a report using the rmdformats
package in R, with the readthedown
format.
How can I change the default overall color?
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.
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>
@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;
}
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