-
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9d6ef6
commit 2717cdd
Showing
12 changed files
with
275 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<!--rehype:ignore:start--> | ||
|
||
# Nord Theme | ||
|
||
<!--rehype:ignore:end--> | ||
|
||
[![npm version](https://img.shields.io/npm/v/@uiw/codemirror-theme-nord.svg)](https://www.npmjs.com/package/@uiw/codemirror-theme-nord) | ||
|
||
<a href="https://uiwjs.github.io/react-codemirror/#/theme/data/nord"> | ||
<img width="436" alt="codemirror-theme-nord" src="https://user-images.githubusercontent.com/1680273/205498304-956bc719-1472-40f0-9c3f-21ac5b9f97a6.png"> | ||
</a> | ||
|
||
## Install | ||
|
||
```bash | ||
npm install @uiw/codemirror-theme-nord --save | ||
``` | ||
|
||
## Usage | ||
|
||
```jsx | ||
import CodeMirror from '@uiw/react-codemirror'; | ||
import { nord } from '@uiw/codemirror-theme-nord'; | ||
import { javascript } from '@codemirror/lang-javascript'; | ||
|
||
function App() { | ||
return ( | ||
<CodeMirror | ||
value="console.log('hello world!');" | ||
height="200px" | ||
theme={nord} | ||
extensions={[javascript({ jsx: true })]} | ||
onChange={(value, viewUpdate) => { | ||
console.log('value:', value); | ||
}} | ||
/> | ||
); | ||
} | ||
export default App; | ||
``` | ||
|
||
```js | ||
import { EditorView } from '@codemirror/view'; | ||
import { EditorState } from '@codemirror/state'; | ||
import { javascript } from '@codemirror/lang-javascript'; | ||
import { nord } from '@uiw/codemirror-theme-nord'; | ||
|
||
const state = EditorState.create({ | ||
doc: 'my source code', | ||
extensions: [nord, javascript({ jsx: true })], | ||
}); | ||
|
||
const view = new EditorView({ | ||
parent: document.querySelector('#editor'), | ||
state, | ||
}); | ||
``` | ||
|
||
## Contributors | ||
|
||
As always, thanks to our amazing contributors! | ||
|
||
<a href="https://github.com/uiwjs/react-codemirror/graphs/contributors"> | ||
<img src="https://uiwjs.github.io/react-codemirror/CONTRIBUTORS.svg" /> | ||
</a> | ||
|
||
Made with [github-action-contributors](https://github.com/jaywcjlove/github-action-contributors). | ||
|
||
## License | ||
|
||
Licensed under the MIT License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "@uiw/codemirror-theme-nord", | ||
"version": "4.15.1", | ||
"description": "Theme nord for CodeMirror.", | ||
"homepage": "https://uiwjs.github.io/react-codemirror/#/theme/data/nord", | ||
"author": "kenny wong <wowohoo@qq.com>", | ||
"license": "MIT", | ||
"main": "./cjs/index.js", | ||
"module": "./esm/index.js", | ||
"scripts": { | ||
"watch": "tsbb watch", | ||
"build": "tsbb build" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/uiwjs/react-codemirror.git" | ||
}, | ||
"files": [ | ||
"src", | ||
"esm", | ||
"cjs" | ||
], | ||
"dependencies": { | ||
"@uiw/codemirror-themes": "4.15.1" | ||
}, | ||
"keywords": [ | ||
"codemirror", | ||
"codemirror6", | ||
"theme", | ||
"nord", | ||
"syntax", | ||
"ide", | ||
"code" | ||
], | ||
"jest": { | ||
"coverageReporters": [ | ||
"lcov", | ||
"json-summary" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
import { tags as t } from '@lezer/highlight'; | ||
import { createTheme } from '@uiw/codemirror-themes'; | ||
|
||
// Colors from https://www.nordtheme.com/docs/colors-and-palettes | ||
export const nord = createTheme({ | ||
theme: 'dark', | ||
settings: { | ||
background: '#2e3440', | ||
foreground: '#FFFFFF', | ||
caret: '#FFFFFF', | ||
selection: '#3b4252', | ||
selectionMatch: '#e5e9f0', | ||
gutterBackground: '#2e3440', | ||
gutterForeground: '#4c566a', | ||
gutterActiveForeground: '#d8dee9', | ||
lineHighlight: '#4c566a', | ||
}, | ||
styles: [ | ||
{ tag: t.keyword, color: '#5e81ac' }, | ||
{ | ||
tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName], | ||
color: '#88c0d0', | ||
}, | ||
{ tag: [t.variableName], color: '#8fbcbb' }, | ||
{ tag: [t.function(t.variableName)], color: '#8fbcbb' }, | ||
{ tag: [t.labelName], color: '#81a1c1' }, | ||
{ | ||
tag: [t.color, t.constant(t.name), t.standard(t.name)], | ||
color: '#5e81ac', | ||
}, | ||
{ tag: [t.definition(t.name), t.separator], color: '#a3be8c' }, | ||
{ tag: [t.brace], color: '#8fbcbb' }, | ||
{ | ||
tag: [t.annotation], | ||
color: '#d30102', | ||
}, | ||
{ | ||
tag: [t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace], | ||
color: '#b48ead', | ||
}, | ||
{ | ||
tag: [t.typeName, t.className], | ||
color: '#ebcb8b', | ||
}, | ||
{ | ||
tag: [t.operator, t.operatorKeyword], | ||
color: '#a3be8c', | ||
}, | ||
{ | ||
tag: [t.tagName], | ||
color: '#b48ead', | ||
}, | ||
{ | ||
tag: [t.squareBracket], | ||
color: '#bf616a', | ||
}, | ||
{ | ||
tag: [t.angleBracket], | ||
color: '#d08770', | ||
}, | ||
{ | ||
tag: [t.attributeName], | ||
color: '#ebcb8b', | ||
}, | ||
{ | ||
tag: [t.regexp], | ||
color: '#5e81ac', | ||
}, | ||
{ | ||
tag: [t.quote], | ||
color: '#b48ead', | ||
}, | ||
{ tag: [t.string], color: '#a3be8c' }, | ||
{ | ||
tag: t.link, | ||
color: '#a3be8c', | ||
textDecoration: 'underline', | ||
textUnderlinePosition: 'under', | ||
}, | ||
{ | ||
tag: [t.url, t.escape, t.special(t.string)], | ||
color: '#8fbcbb', | ||
}, | ||
{ tag: [t.meta], color: '#88c0d0' }, | ||
{ tag: [t.monospace], color: '#d8dee9', fontStyle: 'italic' }, | ||
{ tag: [t.comment], color: '#4c566a', fontStyle: 'italic' }, | ||
{ tag: t.strong, fontWeight: 'bold', color: '#5e81ac' }, | ||
{ tag: t.emphasis, fontStyle: 'italic', color: '#5e81ac' }, | ||
{ tag: t.strikethrough, textDecoration: 'line-through' }, | ||
{ tag: t.heading, fontWeight: 'bold', color: '#5e81ac' }, | ||
{ tag: t.special(t.heading1), fontWeight: 'bold', color: '#5e81ac' }, | ||
{ tag: t.heading1, fontWeight: 'bold', color: '#5e81ac' }, | ||
{ | ||
tag: [t.heading2, t.heading3, t.heading4], | ||
fontWeight: 'bold', | ||
color: '#5e81ac', | ||
}, | ||
{ | ||
tag: [t.heading5, t.heading6], | ||
color: '#5e81ac', | ||
}, | ||
{ tag: [t.atom, t.bool, t.special(t.variableName)], color: '#d08770' }, | ||
{ | ||
tag: [t.processingInstruction, t.inserted], | ||
color: '#8fbcbb', | ||
}, | ||
{ | ||
tag: [t.contentSeparator], | ||
color: '#ebcb8b', | ||
}, | ||
{ tag: t.invalid, color: '#434c5e', borderBottom: `1px dotted #d30102` }, | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../../tsconfig", | ||
"include": ["src"], | ||
"compilerOptions": { | ||
"outDir": "./cjs", | ||
"baseUrl": ".", | ||
"noEmit": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters