|
| 1 | +<!--rehype:ignore:start--> |
| 2 | + |
| 3 | +# Red Theme |
| 4 | + |
| 5 | +<!--rehype:ignore:end--> |
| 6 | + |
| 7 | +[](https://www.npmjs.com/package/@uiw/codemirror-theme-red) |
| 8 | + |
| 9 | +Red theme for cm6, generated from [vscode themes](https://github.com/microsoft/vscode/blob/main/extensions/theme-red/themes/Red-color-theme.json). |
| 10 | + |
| 11 | +<a href="https://uiwjs.github.io/react-codemirror/#/theme/data/red"> |
| 12 | + <img width="436" alt="codemirror-theme-red" src="https://github.com/uiwjs/react-codemirror/assets/1680273/aef0a618-8c74-4466-9a04-35e368f582a7"> |
| 13 | +</a> |
| 14 | + |
| 15 | +## Install |
| 16 | + |
| 17 | +```bash |
| 18 | +npm install @uiw/codemirror-theme-red --save |
| 19 | +``` |
| 20 | + |
| 21 | +```jsx |
| 22 | +import { red, redInit } from '@uiw/codemirror-theme-red'; |
| 23 | + |
| 24 | +<CodeMirror theme={red} /> |
| 25 | +<CodeMirror |
| 26 | + theme={redInit({ |
| 27 | + settings: { |
| 28 | + caret: '#c6c6c6', |
| 29 | + fontFamily: 'monospace', |
| 30 | + } |
| 31 | + })} |
| 32 | +/> |
| 33 | +``` |
| 34 | + |
| 35 | +## API |
| 36 | + |
| 37 | +```tsx |
| 38 | +import { CreateThemeOptions } from '@uiw/codemirror-themes'; |
| 39 | +export declare const defaultSettingsQuietlight: CreateThemeOptions['settings']; |
| 40 | +export declare const redInit: (options?: Partial<CreateThemeOptions>) => import('@codemirror/state').Extension; |
| 41 | +export declare const red: import('@codemirror/state').Extension; |
| 42 | +``` |
| 43 | + |
| 44 | +## Usage |
| 45 | + |
| 46 | +```jsx |
| 47 | +import CodeMirror from '@uiw/react-codemirror'; |
| 48 | +import { red } from '@uiw/codemirror-theme-red'; |
| 49 | +import { javascript } from '@codemirror/lang-javascript'; |
| 50 | + |
| 51 | +function App() { |
| 52 | + return ( |
| 53 | + <CodeMirror |
| 54 | + value="console.log('hello world!');" |
| 55 | + height="200px" |
| 56 | + theme={red} |
| 57 | + extensions={[javascript({ jsx: true })]} |
| 58 | + onChange={(value, viewUpdate) => { |
| 59 | + console.log('value:', value); |
| 60 | + }} |
| 61 | + /> |
| 62 | + ); |
| 63 | +} |
| 64 | +export default App; |
| 65 | +``` |
| 66 | + |
| 67 | +```js |
| 68 | +import { EditorView } from '@codemirror/view'; |
| 69 | +import { EditorState } from '@codemirror/state'; |
| 70 | +import { javascript } from '@codemirror/lang-javascript'; |
| 71 | +import { red } from '@uiw/codemirror-theme-red'; |
| 72 | + |
| 73 | +const state = EditorState.create({ |
| 74 | + doc: 'my source code', |
| 75 | + extensions: [red, javascript({ jsx: true })], |
| 76 | +}); |
| 77 | + |
| 78 | +const view = new EditorView({ |
| 79 | + parent: document.querySelector('#editor'), |
| 80 | + state, |
| 81 | +}); |
| 82 | +``` |
| 83 | + |
| 84 | +## Contributors |
| 85 | + |
| 86 | +As always, thanks to our amazing contributors! |
| 87 | + |
| 88 | +<a href="https://github.com/uiwjs/react-codemirror/graphs/contributors"> |
| 89 | + <img src="https://uiwjs.github.io/react-codemirror/CONTRIBUTORS.svg" /> |
| 90 | +</a> |
| 91 | + |
| 92 | +Made with [github-action-contributors](https://github.com/jaywcjlove/github-action-contributors). |
| 93 | + |
| 94 | +## License |
| 95 | + |
| 96 | +Licensed under the MIT License. |
0 commit comments