Beautiful themes for CodeMirror
npm install thememirror
import {EditorView} from '@codemirror/view';
import {EditorState} from '@codemirror/state';
import {dracula} from 'thememirror';
const state = EditorState.create({
doc: 'my source code',
extensions: [dracula],
});
const view = new EditorView({
parent: document.querySelector('#editor'),
state,
});
Author: William D. Neumann
import {amy} from 'thememirror';
Author: Konstantin Pschera
import {ayuLight} from 'thememirror';
Author: unknown
import {barf} from 'thememirror';
Author: Michael Diolosa
import {bespin} from 'thememirror';
Author: Joe Bergantine
import {birdsOfParadise} from 'thememirror';
Author: unknown
import {boysAndGirls} from 'thememirror';
Author: Fred LeBlanc
import {clouds} from 'thememirror';
Author: Jacob Rus
import {cobalt} from 'thememirror';
Author: unknown
import {coolGlow} from 'thememirror';
Author: Zeno Rocha
import {dracula} from 'thememirror';
Author: TextMate
import {espresso} from 'thememirror';
Author: Liviu Schera
import {noctisLilac} from 'thememirror';
Author: Rosé Pine
import {rosePineDawn} from 'thememirror';
Author: Kenneth Reitz
import {smoothy} from 'thememirror';
Author: Ethan Schoonover
import {solarizedLight} from 'thememirror';
Author: Chris Kempson
import {tomorrow} from 'thememirror';
Create your own theme.
Type: 'light' | 'dark'
Theme variant. Determines which styles CodeMirror will apply by default.
Type: string
Editor background.
Type: string
Default text color.
Type: string
Caret color.
Type: string
Selection background.
Type: string
Background of highlighted lines.
Type: string
Gutter background.
Type: string
Text color inside gutter.
Type: TagStyle[]
Array of styles to customize syntax highlighting. See TagStyle
for a list of available tags to style.
import {createTheme} from 'thememirror';
import {EditorView} from '@codemirror/view';
import {EditorState} from '@codemirror/state';
const myTheme = createTheme({
variant: 'dark',
settings: {
background: '#00254b',
foreground: '#fff',
caret: '#fff',
selectionBackground: '#b36539bf',
gutterBackground: '#00254b',
gutterForeground: '#ffffff70',
lineHighlight: '#00000059',
},
styles: [
{
tag: t.comment,
color: '#0088ff',
},
],
});
const state = EditorState.create({
doc: 'my source code',
extensions: [myTheme],
});
const view = new EditorView({
parent: document.querySelector('#editor'),
state,
});