Skip to content
Discussion options

You must be logged in to vote

Use the codeMirrorExtensions option. CodeMirror themes are extensions, so you can pass an EditorView.theme(...) extension through codeMirrorPlugin:

import { EditorView } from '@codemirror/view'

codeMirrorPlugin({
  codeBlockLanguages: { js: 'JavaScript', css: 'CSS' },
  autoLoadLanguageSupport: true,
  codeMirrorExtensions: [
    EditorView.theme({
      '&': {
        backgroundColor: '#111827',
        color: '#e5e7eb'
      },
      '.cm-gutters': {
        backgroundColor: '#0f172a',
        color: '#94a3b8'
      }
    })
  ]
})

One caveat: MDXEditor's current CodeMirrorEditor also adds its built-in light theme, so if you are overriding the same selectors you may need more specific …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MrDiamondDog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants