|
| 1 | +<!--rehype:ignore:start--> |
| 2 | + |
| 3 | +# NoctisLilac Theme |
| 4 | + |
| 5 | +<!--rehype:ignore:end--> |
| 6 | + |
| 7 | +[](https://www.npmjs.com/package/@uiw/codemirror-theme-noctis-lilac) |
| 8 | + |
| 9 | +This package implements the [nord theme](https://www.nordtheme.com/) for the CodeMirror code editor. |
| 10 | + |
| 11 | +<a href="https://uiwjs.github.io/react-codemirror/#/theme/data/noctis-lilac"> |
| 12 | + <img width="436" alt="codemirror-theme-nord" src="https://user-images.githubusercontent.com/1680273/206086882-b3525159-d987-4d7f-bad3-fdf3d4dbd06f.png"> |
| 13 | +</a> |
| 14 | + |
| 15 | +## Install |
| 16 | + |
| 17 | +```bash |
| 18 | +npm install @uiw/codemirror-theme-noctis-lilac --save |
| 19 | +``` |
| 20 | + |
| 21 | +```jsx |
| 22 | +import { noctisLilac, noctisLilacInit } from '@uiw/codemirror-theme-noctis-lilac'; |
| 23 | + |
| 24 | +<CodeMirror theme={noctisLilac} /> |
| 25 | +<CodeMirror |
| 26 | + theme={noctisLilacInit({ |
| 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 noctisLilacInit: (options?: CreateThemeOptions) => import('@codemirror/state').Extension; |
| 40 | +export declare const noctisLilac: import('@codemirror/state').Extension; |
| 41 | +``` |
| 42 | + |
| 43 | +## Usage |
| 44 | + |
| 45 | +```jsx |
| 46 | +import CodeMirror from '@uiw/react-codemirror'; |
| 47 | +import { noctisLilac } from '@uiw/codemirror-theme-noctis-lilac'; |
| 48 | +import { javascript } from '@codemirror/lang-javascript'; |
| 49 | + |
| 50 | +function App() { |
| 51 | + return ( |
| 52 | + <CodeMirror |
| 53 | + value="console.log('hello world!');" |
| 54 | + height="200px" |
| 55 | + theme={noctisLilac} |
| 56 | + extensions={[javascript({ jsx: true })]} |
| 57 | + onChange={(value, viewUpdate) => { |
| 58 | + console.log('value:', value); |
| 59 | + }} |
| 60 | + /> |
| 61 | + ); |
| 62 | +} |
| 63 | +export default App; |
| 64 | +``` |
| 65 | + |
| 66 | +```js |
| 67 | +import { EditorView } from '@codemirror/view'; |
| 68 | +import { EditorState } from '@codemirror/state'; |
| 69 | +import { javascript } from '@codemirror/lang-javascript'; |
| 70 | +import { noctisLilac } from '@uiw/codemirror-theme-noctis-lilac'; |
| 71 | + |
| 72 | +const state = EditorState.create({ |
| 73 | + doc: 'my source code', |
| 74 | + extensions: [noctisLilac, javascript({ jsx: true })], |
| 75 | +}); |
| 76 | + |
| 77 | +const view = new EditorView({ |
| 78 | + parent: document.querySelector('#editor'), |
| 79 | + state, |
| 80 | +}); |
| 81 | +``` |
| 82 | + |
| 83 | +## Contributors |
| 84 | + |
| 85 | +As always, thanks to our amazing contributors! |
| 86 | + |
| 87 | +<a href="https://github.com/uiwjs/react-codemirror/graphs/contributors"> |
| 88 | + <img src="https://uiwjs.github.io/react-codemirror/CONTRIBUTORS.svg" /> |
| 89 | +</a> |
| 90 | + |
| 91 | +Made with [github-action-contributors](https://github.com/jaywcjlove/github-action-contributors). |
| 92 | + |
| 93 | +## License |
| 94 | + |
| 95 | +Licensed under the MIT License. |
0 commit comments