Joplin change code block color

2025-07-29 19:46

In Joplin, changing the background color of an entire code block (not just the background behind individual lines of text) is possible, but it depends on how you're viewing the note and whether you're willing to use custom CSS.

Here’s a breakdown:

---

✅ Yes, it's possible using custom CSS (for the rendered Markdown view, not the editor)

Joplin supports custom user stylesheets:

userstyle.css – for note viewer (rendered Markdown)

userchrome.css – for the app’s UI

You can apply a background color to code blocks like this:

🔧 Steps:

1. Open Joplin.

2. Go to Tools → Options → Appearance → scroll down to "Show Advanced Settings".

3. Click the link to open the profile directory.

4. Open or create a file called userstyle.css.

5. Add this CSS:

pre {

background-color: #1e1e1e !important; /* or any color you like */

padding: 10px;

border-radius: 6px;

display: block;

}

> pre is the HTML tag used to render code blocks in Markdown.

6. Restart Joplin (or switch notes back and forth) to see the effect.

---

🧾 Note:

This will not change the appearance in the editor (WYSIWYG or Markdown), only in the rendered Markdown preview.

If you're using the WYSIWYG editor, it's still affected by the same userstyle.css, but results may vary slightly depending on Joplin version and theme.

---

❌ Not possible without CSS:

There is no built-in option in the UI to change the full background of code blocks—it requires CSS.

---

Would you like to also change inline code (like this) or just the multiline code blocks (```)? I can give you CSS for that too.