R Markdown is one of the best tools for creating technical reports — but the default theme often looks outdated.
A clean, modern theme makes your reports easier to read and more professional.
In this guide, I’ll show you how to build a simple, reusable R Markdown theme you can apply to any project.
---
title: "Clean R Markdown Theme"
author: "Your Name"
output:
html_document:
theme: null
css: "style.css"
---
We disable the default theme (theme: null) so we can fully control the styling.
Create a Custom CSS File
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: #f7f7f7;
line-height: 1.6;
color: #333;
}
h1, h2, h3 {
font-weight: 600;
color: #222;
}
code {
background: #eee;
padding: 2px 4px;
border-radius: 4px;
}
pre {
background: #272822;
color: #f8f8f2;
padding: 12px;
border-radius: 6px;
}
This gives your report a clean, modern look.
Style the Title Block
h1.title {
margin-top: 40px;
font-size: 2.2rem;
text-align: center;
}
.author, .date {
text-align: center;
color: #555;
}
This makes your report look polished and professional.
Improve Tables and Figures
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
}
th, td {
padding: 10px;
border-bottom: 1px solid #ddd;
}
img {
display: block;
margin: 20px auto;
max-width: 100%;
}
Render the Document
rmarkdown::render("report.Rmd")
You’ll get a clean, modern HTML report using your custom theme.
Wrap‑Up
A custom R Markdown theme gives your reports:
a professional look
consistent branding
better readability
a reusable structure for future projects
This is the same approach I use in my own R Markdown templates and upcoming HTML template pack.
Top comments (0)