Skip to content

How to Create a Custom Markdown Editor Theme

This guide is for you if the eight included themes do not quite fit your preferred colors or typography. You only need to know the basics of CSS, such as how to specify colors.

1. What you can do

In Markzen Editor, you can customize the appearance of the Source pane and Live Preview pane with a CSS file.

  • Colors (backgrounds, text, links, code, and more)
  • Body font, font size, and line height
  • Sizes of headings, tables, and code blocks

All you need to do is edit a CSS template exported by the app and upload it. You do not have to write CSS from scratch.

What you can customize

Area Customizable?
Source pane Yes
Live Preview pane Yes (uses different CSS from the Source pane)
Folder browser, tabs, toolbar, status bar, and Settings No (you can only choose Light, Dark, or Follow system)
App-wide UI font and the monospace font for line numbers and code blocks No

2. Create a theme in three steps

  1. Download a template
    • Open Settings and go to Appearance.
    • Under “Download CSS template,” choose the Theme and Appearance (Light or Dark) you want to start with, then select “Download.”
    • The app saves a CSS file with the colors of your chosen theme.
  2. Edit the CSS
    • Open it in your preferred text editor (you can use Markzen Editor) and change only the values of --mz-* declarations.
  3. Upload it
    • Under “Source pane theme” and “Live Preview pane theme,” select “Upload Theme” and choose your edited CSS file.
    • The theme applies immediately, and “Use custom theme” turns on automatically.

Tip: If you want dark colors, start with a Dark template to save some adjustments.

Upload a theme for each pane

The Source pane and Live Preview pane import CSS separately.

  • The template contains a settings block for each pane.
  • You can upload CSS for just one pane. The other pane keeps the appearance of the default theme.
  • You can have one custom theme per pane. There is no feature for saving and switching among multiple custom themes. To keep several color schemes, save your CSS files yourself and upload the one you need again.

Restore the default theme

Each pane’s custom theme has a “Delete” button. Deleting it removes the imported CSS and restores the default theme (you cannot recover the deleted CSS, so keep the original file if you need it). Turning off “Use custom theme” switches to the default theme while keeping the imported CSS.

3. How to write the CSS

The template looks like this:

[data-pane="raw"][data-pane-theme="custom"] {
  --mz-editor-bg: #fbfaf8;
  --mz-text-body: #2c2c2a;
  /* ...other tokens... */
}

[data-pane="wysiwyg"][data-pane-theme="custom"] {
  --mz-editor-bg: #ffffff;
  --mz-text-body: #2c2c2a;
  /* ...other tokens... */
}
  • raw identifies the Source pane, and wysiwyg identifies the Live Preview pane.
  • Change only the values of --mz-* declarations. Do not change the selectors (the [data-pane=...] parts).
  • Values can be colors (#1f5fd0, rgb(), rgba()), sizes (15px), multipliers (1.7), or font names.
  • You can add comments (/* ... */) freely.

Rules to follow

Rule Reason or behavior
Keep every token in the template If even one is missing, the CSS cannot be imported. The dialog lists the missing token names. Add them and upload the file again.
Do not write anything other than --mz-* declarations Regular CSS properties (display, position, and so on), @import, and styles for body or :root are ignored. Only --mz-* declarations can change the appearance.
Do not use external references such as url() Values containing url(), image-set(), expression(), javascript:, or a backslash (\) cannot be imported. You cannot set a background image.
!important is unnecessary It has no effect.
You cannot change --mz-font-ui or --mz-font-mono These control the app-wide UI font and monospace font. They do not appear in the template, and they cannot be imported if added.

If a declaration cannot be imported, the dialog shows the reason.

Reason Meaning
unsafe value (e.g. url()) The value contains an external reference or expression
this property cannot be changed An immutable token, such as --mz-font-ui
invalid name format The name does not start with --mz- followed by lowercase English letters, digits, or hyphens

The theme controls typography

While “Use custom theme” is on, the font, size, and line height settings under Appearance in Settings do not apply. Your CSS values take precedence. You control the typography in your CSS (the template includes default values).

The editor’s zoom still works with a custom theme. Heading, table, and code sizes scale with zoom based on your CSS values.

4. Token reference

The example values come from the included Markzen theme (Light).

4.1 Shared tokens (Source and Live Preview panes)

Basic colors

Token Purpose Example
--mz-editor-bg Background of the document area #fbfaf8 (Source) / #ffffff (Live Preview)
--mz-text-strong Headings and emphasized text #1a1a18
--mz-text-body Body text #2c2c2a
--mz-text-faint Faintest secondary text, such as folded rows #74726a

Search and highlights

Token Purpose Example
--mz-cross-pane-highlight Highlight for the line being edited in the other pane rgba(31, 95, 208, 0.08)
--mz-search-match Background of a match in Find in File #ffff00
--mz-search-match-active Background of the currently selected search match #ff9632

Markdown markers and inline code

Token Purpose Example
--mz-syntax-marker Default color of Markdown markers such as #, *, and ` #74716a
--mz-syntax-code Inline code text #b4462f

Code block syntax colors

Token Purpose Example
--mz-code-keyword Keywords such as function and return #8250bf
--mz-code-func Function names #2a6eb8
--mz-code-string Strings #4c7a2f
--mz-code-number Numbers and Boolean values #a94e24
--mz-code-comment Comments #6f6d66
--mz-code-type Type, class, and tag names #1f6f73
--mz-code-prop Property and attribute names #35332e
--mz-code-inserted Added lines in a diff #2e7d3f
--mz-code-deleted Deleted lines in a diff #b23b32

4.2 Source pane tokens (the data-pane="raw" block)

Colors by Markdown marker type

These tokens color different kinds of markers. Change a value when you want to adjust that color.

Token Applies to Example
--mz-syntax-marker-heading Heading # and heading text #3b6fb5
--mz-syntax-marker-emphasis Emphasis ** * _ #97671b
--mz-syntax-marker-strike Strikethrough ~~ #a85a5a
--mz-syntax-marker-code Code ` and fenced code language names #2b7d6a
--mz-syntax-marker-list List markers - 1. #7a58b5
--mz-syntax-marker-quote Blockquote > #547639
--mz-syntax-marker-link Links []() and autolinks <> #2f6fa8
--mz-syntax-marker-image Images ![]() #8f6020
--mz-syntax-marker-table Table separator | #5a8a8a
--mz-syntax-marker-rule Horizontal rule --- #a1508f
--mz-syntax-marker-highlight Highlight == #7f6a12
--mz-syntax-string String literals #79692e

Line numbers, cursor, and selection

Token Purpose Example
--mz-line-number Line number text (lines without the cursor) rgba(42, 42, 42, 0.6)
--mz-line-number-active Line number text (line with the cursor) #2a2a2a
--mz-line-number-bg Line number gutter background #f4f4f4
--mz-raw-active-line Background of the line with the cursor rgba(26, 26, 24, 0.035)
--mz-raw-codeblock-bg Code block background #f4f2ed
--mz-selection Selection color (Source pane only) rgba(31, 95, 208, 0.16)
--mz-caret Text cursor color #1f5fd0

Typography

Token Purpose Example
--mz-raw-font-family Body font Inter Variable, …
--mz-raw-font-size-base Body font size 13.5px
--mz-raw-line-height Line height multiplier 1.7
--mz-raw-h1-size to
--mz-raw-h6-size
Heading sizes 1 through 6 24px to 15px

4.3 Live Preview pane tokens (the data-pane="wysiwyg" block)

Accents and borders

Token Purpose Example
--mz-accent Accent color (checkboxes, image handles, and more) #1f5fd0
--mz-on-accent Icons on the accent color #ffffff
--mz-link Link text #1f5fd0
--mz-link-underline Link underline #a9c2ee
--mz-label-section Labels such as small headings (h6) #6e6b64
--mz-heading-border Dividing line below headings 1 and 2 #cccccc
--mz-hr-border Horizontal rule (---) #cccccc
--mz-window-border Strong borders, such as checkbox outlines #e3e0d8
--mz-section-border Subtle borders, such as table lines and dividers #ebe8e1

Set --mz-heading-border and --mz-hr-border to the same value if you want heading borders and horizontal rules to have the same intensity.

Blockquotes and inline formatting

Token Purpose Example
--mz-blockquote-border Blockquote border #d9d5cc
--mz-blockquote-text Blockquote text #55524b
--mz-wysiwyg-strike Strikethrough and completed task text #757269
--mz-highlight-bg Highlight (==) background #fbeaa4
--mz-highlight-text Highlight text #1f1e1b
--mz-inline-code-bg Inline code background #f1efea
--mz-inline-code-border Inline code border #e2ded6

Code blocks and front matter

Token Purpose Example
--mz-codeblock-bg Code block background #f4f2ed
--mz-codeblock-header Code block header background #ebe8e1
--mz-code-label-muted Secondary text, such as language names and the copy button #6e6b64
--mz-success “Copied” message #2e7d3f
--mz-frontmatter-bg Background of the front matter card (YAML at the start of the file) #f6f4f0
--mz-frontmatter-key Front matter key: text #964532

Front matter color tip: Give --mz-frontmatter-key enough contrast against --mz-frontmatter-bg to stay readable. Changing the background without changing the text color can make the keys hard to read.

Images and controls

Token Purpose Example
--mz-image-control-bg Image control panel background rgba(26, 25, 23, 0.55)
--mz-image-control-bg-strong Image control panel background when emphasized rgba(26, 25, 23, 0.85)
--mz-image-control-shadow Image handle shadow 0 1px 3px rgba(26, 25, 23, 0.35)
--mz-image-aspect-unlocked Warning color when aspect ratio is unlocked #e8792f
--mz-control-bg Checkbox background #ffffff

Typography

Token Purpose Example
--mz-wysiwyg-font-family Body font Inter Variable, …
--mz-wysiwyg-font-size-base Body font size 15px
--mz-wysiwyg-line-height Body line height multiplier 1.5 (the Japanese default is 1.75)
--mz-wysiwyg-h1-size to
--mz-wysiwyg-h6-size
Heading sizes 1 through 6 30px / 26px / 22.5px / 19.5px / 17px / 15px
--mz-table-font-size Table font size 14px
--mz-code-font-size Code block font size 13.5px
--mz-wysiwyg-h1-line-height to
--mz-wysiwyg-h6-line-height
Heading line height multipliers; optional Default value for each language

You can omit heading line height tokens such as --mz-wysiwyg-h1-line-height. When omitted, the app uses the default value for the display language.

4.4 How to write values

Type Example
Color #1f5fd0, #1f5fd080 (with transparency), rgb(31 95 208), rgba(31, 95, 208, 0.16)
Size Use px, as in 15px (not rem or %)
Multiplier (line height) Use a unitless number, as in 1.7
Font Separate names with commas, as in "Noto Sans JP", system-ui, sans-serif. If a font is unavailable, the next one is used.
Shadow 0 1px 3px rgba(0, 0, 0, 0.35)

5. Tips for choosing colors

  • Keep enough contrast between the background and text. A contrast ratio of at least 4.5:1 is a useful target for body text. Check it with a contrast calculator.
  • Keep light and dark colors consistent. Custom themes do not have separate Light and Dark variants. For a dark theme, choose text, border, and code colors that work on a dark background, not just a dark background color. Starting from an included theme’s template makes this easier.
  • Check text and icons on your accent color. Use a dark --mz-on-accent with a light accent, and a light value with a dark accent.
  • Fonts apply to body text only. You can change the body font. If the specified font is not installed, the app uses the next font in the list.
  • Make search highlights stand out. If --mz-search-match is too close to the background color, search results can be hard to find.

6. How themes affect PDF export

To use your custom theme’s colors in a PDF, turn on “Use the custom theme” in the PDF export settings. When it is off, the PDF uses the Light variant of the selected included theme (so the PDF stays light even if the app is dark).

7. Troubleshooting

Symptom What to do
“The theme is missing declarations” appears Add the listed tokens. Check that you have not removed any lines from the template, and copy any missing declarations back from it.
“No applicable –mz-* declarations were found in this CSS” appears Check the CSS syntax for missing closing { } or ;. Editing a downloaded template is the safest starting point.
“Some declarations could not be imported” appears Correct the listed reasons (unsafe values, immutable properties, or invalid names), then upload the file again.
Some colors do not change Check that you uploaded Source pane colors under “Source pane theme” and Live Preview colors under “Live Preview pane theme.” Each pane uses separate CSS.
The font size does not match Settings While a custom theme is on, the CSS controls the font, size, and line height. Change the CSS values.
The custom theme turns off after startup If an app update adds tokens, older CSS is treated as incomplete and the default theme is restored. Download a new template, transfer your values, and upload it again.
You want to restore the default theme Select “Delete” or turn off “Use custom theme.”