Reputation: 1778
I'm generating a report using the rmdformats
package in R, with the readthedown
format.
How can I change the default overall color?
Upvotes: 8
Views: 9971
Reputation: 3043
I had to alter some more selectors. Here I give blues and oranges.
Look for the github code here
Upvotes: 0
Reputation: 608
I ran into the same "issue". After inspecting the source of html page, I found that the following items in CSS file below are sufficient. In particular, the topleft box backgroung color is customized with #content h2 {}
.
#sidebar {
background: #5A7B9C;
}
#postamble {
background:#003366;
border-top:solid 10px #5A7B9C;
}
.title {
text-align: center;
color: #003366;
}
.subtitle {
color: #003366;
}
h1, h2, h3, h4, h5, h6, legend {
color: #5A7B9C;
}
#content h2 {
background-color: #003366;
}
Upvotes: 3
Reputation: 517
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>
Upvotes: 6
Reputation: 49033
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.
Upvotes: 20
Reputation: 83
@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;
}
Upvotes: 5