@uiw/codemirror-theme-red
v4.23.6
Published
Theme red for CodeMirror.
Downloads
20,683
Readme
Red Theme
Red theme for cm6, generated from vscode themes.
Install
npm install @uiw/codemirror-theme-red --save
import { EditorState } from '@codemirror/state';
import { javascript } from '@codemirror/lang-javascript';
import { red } from '@uiw/codemirror-theme-red';
const state = EditorState.create({
doc: 'my source code',
extensions: [red, javascript({ jsx: true })],
});
Using in React:
import { red, redInit } from '@uiw/codemirror-theme-red';
<CodeMirror theme={red} />
<CodeMirror
theme={redInit({
settings: {
caret: '#c6c6c6',
fontFamily: 'monospace',
}
})}
/>
API
import { CreateThemeOptions } from '@uiw/codemirror-themes';
export declare const defaultSettingsQuietlight: CreateThemeOptions['settings'];
export declare const redInit: (options?: Partial<CreateThemeOptions>) => import('@codemirror/state').Extension;
export declare const red: import('@codemirror/state').Extension;
Usage
import CodeMirror from '@uiw/react-codemirror';
import { red } from '@uiw/codemirror-theme-red';
import { javascript } from '@codemirror/lang-javascript';
function App() {
return (
<CodeMirror
value="console.log('hello world!');"
height="200px"
theme={red}
extensions={[javascript({ jsx: true })]}
onChange={(value, viewUpdate) => {
console.log('value:', value);
}}
/>
);
}
export default App;
import { EditorView } from '@codemirror/view';
import { EditorState } from '@codemirror/state';
import { javascript } from '@codemirror/lang-javascript';
import { red } from '@uiw/codemirror-theme-red';
const state = EditorState.create({
doc: 'my source code',
extensions: [red, javascript({ jsx: true })],
});
const view = new EditorView({
parent: document.querySelector('#editor'),
state,
});
Contributors
As always, thanks to our amazing contributors!
Made with github-action-contributors.
License
Licensed under the MIT License.