Repository navigation
Theming
Important
Requires MarkEdit v1.38.0 or later.
Customize a few colors or create a theme using CSS variables for Markdown, syntax highlighting, and editor controls. For new themes, plain CSS is recommended over JavaScript.
Quick start · Typography · Markdown · Syntax colors · Editor controls
Open MarkEdit's Documents folder from the app menu, as described in Customization. Add this to editor.css:
@media (prefers-color-scheme: light) {
.cm-editor {
--markedit-editor-background-color: #fff4dc;
--markedit-editor-color: #38234f;
--markedit-markdown-heading-color: #7b285f;
--markedit-markdown-heading-text-shadow: none;
--markedit-selection-background-color: #ffd166;
}
}Restart MarkEdit. This changes a few colors in light appearance; everything else keeps its existing styling.
The file is located at:
~/Library/Containers/app.cyan.markedit/Data/Documents/editor.css
You can also put a .css file in the adjacent styles folder. Keep related rules in one file rather than relying on the loading order of separate stylesheets.
To undo a customization, remove its declaration or stylesheet and restart the app.
- Choose a built-in base theme. Set only the values you want to change; unspecified values keep the base styling.
-
Declare variables on
.cm-editor. This works for colors and typography without adding!important. -
Specific controls win over automatic defaults. For example,
--markedit-completion-backgroundoverrides the popup background derived from the editor. - Avoid competing themes. Other stylesheets and JavaScript themes can override your rules.
Changing the editor's foreground and background does not recolor every syntax token, selection, or search highlight. Use the reference tables below to customize those separately.
Use prefers-color-scheme to define separate palettes:
@media (prefers-color-scheme: light) {
.cm-editor {
--markedit-editor-background-color: #faf8f3;
--markedit-editor-color: #30343b;
--markedit-markdown-heading-color: #7651a8;
--markedit-markdown-heading-text-shadow: none;
--markedit-markdown-link-color: #2468a0;
--markedit-syntax-comment-color: #667466;
--markedit-caret-color: #7651a8;
--markedit-selection-background-color: #ddd1ef;
}
}
@media (prefers-color-scheme: dark) {
.cm-editor {
--markedit-editor-background-color: #20242c;
--markedit-editor-color: #d8dee9;
--markedit-markdown-heading-color: #c7a6ee;
--markedit-markdown-heading-text-shadow: none;
--markedit-markdown-link-color: #88c0d0;
--markedit-syntax-comment-color: #97aa97;
--markedit-caret-color: #c7a6ee;
--markedit-selection-background-color: #49415c;
}
}The query follows the editor window's appearance, including the theme selected in MarkEdit's settings. Setting a dark background alone does not switch the window to dark appearance.
Leave typography unset if your theme should respect the user's font and size preferences. Otherwise, use these controls:
| Variable | Value / purpose |
|---|---|
--markedit-editor-font-family |
CSS font-family list for editor text and completion text |
--markedit-editor-font-size |
Editor font size, for example 18px
|
--markedit-editor-line-height |
Prefer a unitless number such as 1.6
|
--markedit-monospace-font-family |
Font-family list for code and other monospace content |
--markedit-fold-placeholder-font-size |
Size of the folded-content placeholder |
--markedit-markdown-heading1-font-size through --markedit-markdown-heading6-font-size
|
Size for each heading level |
.cm-editor {
--markedit-editor-font-family: Georgia, "Times New Roman", serif;
--markedit-editor-line-height: 1.6;
--markedit-monospace-font-family: Menlo, monospace;
}CSS typography overrides the corresponding app preferences; remove it to restore them. Heading and quote weight/style controls preserve Markdown bold and italic within those contexts.
Variable names follow --markedit-<role>-<property>. For example:
.cm-editor {
--markedit-markdown-bold-color: #a54a16;
--markedit-markdown-quote-font-style: normal;
--markedit-markdown-inline-code-color: #9b315e;
--markedit-markdown-inline-code-background-color: rgba(155, 49, 94, 0.1);
}Every role below supports these property suffixes:
-
color: a CSS color. -
text-shadow: a CSS text shadow, ornoneto remove a theme's glow. -
font-weight: for examplenormal,bold, or500. -
font-style: for examplenormaloritalic.
| Role | Applies to |
|---|---|
markdown-heading |
General heading styling; color/shadow defaults exclude quoted headings |
markdown-heading1, markdown-heading2, markdown-heading3, markdown-heading4, markdown-heading5, markdown-heading6
|
Individual heading levels, including Setext levels 1 and 2 |
markdown-quote |
Blockquote text |
markdown-bold |
Bold text |
markdown-italic |
Italic text |
markdown-strikethrough |
Struck-through text |
markdown-link |
Link text and destinations |
markdown-link-destination |
The URL/destination portion of a link |
markdown-inline-code |
Inline code |
markdown-divider |
Horizontal rules |
markdown-code-info |
Fenced-code language/info text |
markdown-marker |
General Markdown delimiters |
markdown-list-marker |
List prefixes |
markdown-table-marker |
Table delimiters |
markdown-quote-marker |
Quote prefixes |
markdown-link-marker |
Link delimiters |
markdown-code-marker |
Code delimiters |
Specific inline colors, such as link colors, can override heading defaults. Marker colors take precedence on delimiters. Quoted headings use quote colors.
Additional Markdown controls:
| Variable | Value / purpose |
|---|---|
--markedit-markdown-link-text-underline-position |
CSS text-underline-position, for example under
|
--markedit-markdown-inline-code-background-color |
Inline-code background |
--markedit-markdown-code-block-background-color |
Source code-block tint |
--markedit-markdown-frontmatter-background-color |
Source frontmatter tint |
--markedit-markdown-table-background-color |
Source Markdown-table tint, not rendered table widgets |
--markedit-markdown-task-marker-color |
Task-list marker color |
Uniform means one color across a heading or quote, including links, emphasis, and markers. Font size, bold, and italic remain unchanged.
Without a uniform override, a blue heading can contain a red link:
.cm-editor {
--markedit-markdown-heading-color: #2468a0;
--markedit-markdown-link-color: #b03a48;
}To make the whole heading blue, including its links and markers, add:
.cm-editor {
--markedit-markdown-heading-uniform-color: #2468a0;
--markedit-markdown-heading-uniform-text-shadow: none;
}There are four optional controls:
| Variable | Purpose |
|---|---|
--markedit-markdown-heading-uniform-color |
Uniform heading color |
--markedit-markdown-heading-uniform-text-shadow |
Uniform heading shadow |
--markedit-markdown-quote-uniform-color |
Uniform quote color |
--markedit-markdown-quote-uniform-text-shadow |
Uniform quote shadow |
Uniform values override individual Markdown colors/shadows within that context. Quoted headings use the quote-uniform controls. Remove these declarations to restore individual colors. Embedded code and widgets keep their own styling.
Use translucent colors for source-block backgrounds:
.cm-editor {
--markedit-markdown-code-block-background-color: rgba(90, 120, 170, 0.1);
--markedit-markdown-frontmatter-background-color: rgba(130, 100, 150, 0.1);
--markedit-markdown-table-background-color: rgba(90, 130, 110, 0.1);
}Warning
Opaque block backgrounds can hide the selection highlight. Start with 10-15% opacity and check contrast. This also applies to inserted/deleted token backgrounds.
Syntax roles describe how the editor recognizes a token, so their use varies by language.
Every role supports color, text-shadow, font-weight, and font-style: for example, --markedit-syntax-keyword-color or --markedit-syntax-comment-font-style.
| Group | Roles |
|---|---|
| General |
syntax-name, syntax-name-definition, syntax-literal, syntax-meta, syntax-processing-instruction, syntax-comment
|
| Keywords |
syntax-keyword, syntax-keyword-definition, syntax-keyword-modifier, syntax-keyword-control, syntax-keyword-module, syntax-keyword-operator
|
| Special values |
syntax-self, syntax-null, syntax-unit, syntax-atom, syntax-boolean, syntax-number
|
| Operators and punctuation |
syntax-operator, syntax-punctuation, syntax-separator
|
| Brackets |
syntax-bracket, syntax-bracket-curly, syntax-bracket-curly-special, syntax-bracket-square, syntax-bracket-angle
|
| Strings |
syntax-string, syntax-string-special, syntax-character, syntax-regular-expression, syntax-escape, syntax-url
|
| Variables |
syntax-variable, syntax-variable-local, syntax-variable-definition, syntax-constant, syntax-variable-special
|
| Properties and functions |
syntax-property, syntax-property-definition, syntax-function, syntax-function-property
|
| Types and markup |
syntax-type, syntax-type-definition, syntax-namespace, syntax-class, syntax-attribute, syntax-annotation, syntax-tag, syntax-label
|
| Other |
syntax-macro, syntax-inserted, syntax-deleted, syntax-changed, syntax-invalid
|
Additional controls:
| Variable | Purpose |
|---|---|
--markedit-syntax-inserted-background-color |
Inserted-token background |
--markedit-syntax-deleted-background-color |
Deleted-token background |
--markedit-syntax-invalid-border-bottom |
CSS bottom border, for example 1px dotted #c00028
|
Start with broad roles such as syntax-name or syntax-keyword. More specific roles let you distinguish functions, definitions, and other cases; their overrides generally take precedence.
Use these to customize controls inside the editor.
| Area | Variables |
|---|---|
| Editor |
--markedit-editor-color, --markedit-editor-background-color
|
| Caret | --markedit-caret-color |
| Selection | --markedit-selection-background-color |
| Other occurrences of selected text |
--markedit-selection-match-color, --markedit-selection-match-background-color
|
| Search matches |
--markedit-search-match-color, --markedit-search-match-background-color, --markedit-search-match-outline
|
| Selected search match |
--markedit-search-match-selected-color, --markedit-search-match-selected-background-color, --markedit-search-match-selected-box-shadow
|
| Matching brackets |
--markedit-bracket-match-color, --markedit-bracket-match-background-color, --markedit-bracket-match-box-shadow, --markedit-bracket-match-outline
|
| Gutter |
--markedit-gutter-color, --markedit-gutter-background-color, --markedit-gutter-active-color, --markedit-gutter-active-background-color
|
| Folding |
--markedit-fold-color, --markedit-fold-placeholder-background-color
|
| Visible whitespace |
--markedit-invisibles-color, --markedit-invisibles-selected-color
|
| Active line |
--markedit-line-active-background-color, --markedit-line-active-box-shadow
|
| Completion popup |
--markedit-completion-background, --markedit-completion-border-color
|
| Selected completion |
--markedit-completion-selected-color, --markedit-completion-selected-background
|
| Matching completion text |
--markedit-completion-match-color, --markedit-completion-match-text-shadow
|
| Built-in preview button |
--markedit-preview-button-color, --markedit-preview-button-hover-background-color
|
background accepts colors or gradients; background-color accepts colors only. Other suffixes use the matching CSS property's syntax. Use none to remove a shadow or outline.
You do not need to set every UI color. When you customize editor colors, these defaults follow them:
| Surface | Default behavior without a component override |
|---|---|
| Gutter background / active gutter text | Follow the editor background / text |
| Completion text / selected row | Follow editor text / background, retaining the theme's light/dark treatment |
| Completion popup | Uses a translucent editor background and a border tinted from editor text |
| Fold text / selected whitespace | Use muted editor-text colors |
| Preview-button icon | Tries semantic comment color, then editor text color, then the original theme icon color |
| Preview-button hover | Uses a translucent editor-text tint |
| Built-in preview overlay and table preview | Follow explicit editor foreground/background overrides |
Use a dedicated variable to override any of these defaults. Selection, search, caret, ordinary gutter/whitespace colors, and inline-code/folded-placeholder backgrounds remain separate choices.
Existing JavaScript themes remain supported through MarkEdit-theming. Update them before combining them with CSS customizations; some of their rules may still take precedence.
For the most predictable results when creating a CSS theme, use a built-in base rather than another theme extension.
If you use MarkEdit-preview or Interactive Tables, update them and check your theme with their in-editor content.
Separate preview panes, exported HTML, Quick Look, and other extension interfaces can have their own themes. Configure those separately; editor CSS is not a theme for every view in the app.
Use hex, rgb(), or rgba() for the editor background to keep the native window background consistent. Other formats may render correctly inside the editor without updating native surfaces.
Restart MarkEdit after editing a stylesheet. Animated or script-driven color changes may not update every popup or native surface immediately.
Declare semantic variables on .cm-editor, rather than on individual highlighted tokens. This works across supported macOS versions:
.cm-editor {
--markedit-syntax-comment-color: #667466;
--markedit-syntax-comment-font-style: normal;
}You do not need to find the comment elements or target CodeMirror's generated class names.
- Use v1.38.0+, one stylesheet, and a built-in base theme.
- Check both appearances: headings with links/bold text, quotes, code, tables, and frontmatter.
- Check selection/search contrast, completion popups, folds, and whitespace markers.
- Remove your overrides and confirm the original appearance returns.
- If a color does not change, temporarily disable theme extensions and inspect the element in Web Inspector for competing rules.
The repository includes GitHub Light, Nord, and Noctis Lilac CSS references.
Use them as examples, remembering that unspecified values still come from your chosen base. Wrap single-palette styles in a light/dark appearance query.
To share your theme, provide the .css file, its intended base theme and appearance, and instructions to place it in the styles folder.