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
0eb8053
commit a2fe1d8
Showing
12 changed files
with
263 additions
and
0 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,68 @@ | ||
<!--rehype:ignore:start--> | ||
|
||
# Material Theme | ||
|
||
<!--rehype:ignore:end--> | ||
|
||
[![npm version](https://img.shields.io/npm/v/@uiw/codemirror-theme-material.svg)](https://www.npmjs.com/package/@uiw/codemirror-theme-material) | ||
|
||
<a href="https://uiwjs.github.io/react-codemirror/#/theme/data/material"> | ||
<img width="436" alt="codemirror-theme-material" src="https://user-images.githubusercontent.com/1680273/205537793-79f9c99c-831a-4ce3-8189-78b42896656f.png"> | ||
</a> | ||
|
||
## Install | ||
|
||
```bash | ||
npm install @uiw/codemirror-theme-material --save | ||
``` | ||
|
||
## Usage | ||
|
||
```jsx | ||
import CodeMirror from '@uiw/react-codemirror'; | ||
import { material } from '@uiw/codemirror-theme-material'; | ||
import { javascript } from '@codemirror/lang-javascript'; | ||
|
||
function App() { | ||
return ( | ||
<CodeMirror | ||
value="console.log('hello world!');" | ||
height="200px" | ||
theme={material} | ||
extensions={[javascript({ jsx: true })]} | ||
/> | ||
); | ||
} | ||
export default App; | ||
``` | ||
|
||
```js | ||
import { EditorView } from '@codemirror/view'; | ||
import { EditorState } from '@codemirror/state'; | ||
import { javascript } from '@codemirror/lang-javascript'; | ||
import { material } from '@uiw/codemirror-theme-material'; | ||
|
||
const state = EditorState.create({ | ||
doc: 'my source code', | ||
extensions: [material, 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-material", | ||
"version": "4.16.0", | ||
"description": "Theme material for CodeMirror.", | ||
"homepage": "https://uiwjs.github.io/react-codemirror/#/theme/data/material", | ||
"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.16.0" | ||
}, | ||
"keywords": [ | ||
"codemirror", | ||
"codemirror6", | ||
"theme", | ||
"material", | ||
"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,112 @@ | ||
import { tags as t } from '@lezer/highlight'; | ||
import { createTheme } from '@uiw/codemirror-themes'; | ||
|
||
export const material = createTheme({ | ||
theme: 'dark', | ||
settings: { | ||
background: '#2e3235', | ||
foreground: '#bdbdbd', | ||
caret: '#a0a4ae', | ||
selection: '#d7d4f0', | ||
selectionMatch: '#d7d4f0', | ||
gutterBackground: '#2e3235', | ||
gutterForeground: '#999', | ||
gutterActiveForeground: '#4f5b66', | ||
lineHighlight: '#545b61', | ||
}, | ||
styles: [ | ||
{ tag: t.keyword, color: '#cf6edf' }, | ||
{ | ||
tag: [t.name, t.deleted, t.character, t.macroName], | ||
color: '#56c8d8', | ||
}, | ||
{ tag: [t.propertyName], color: '#facf4e' }, | ||
{ tag: [t.variableName], color: '#bdbdbd' }, | ||
{ tag: [t.function(t.variableName)], color: '#56c8d8' }, | ||
{ tag: [t.labelName], color: '#cf6edf' }, | ||
{ | ||
tag: [t.color, t.constant(t.name), t.standard(t.name)], | ||
color: '#facf4e', | ||
}, | ||
{ tag: [t.definition(t.name), t.separator], color: '#fa5788' }, | ||
{ tag: [t.brace], color: '#cf6edf' }, | ||
{ | ||
tag: [t.annotation], | ||
color: '#ff5f52', | ||
}, | ||
{ | ||
tag: [t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace], | ||
color: '#ffad42', | ||
}, | ||
{ | ||
tag: [t.typeName, t.className], | ||
color: '#ffad42', | ||
}, | ||
{ | ||
tag: [t.operator, t.operatorKeyword], | ||
color: '#7186f0', | ||
}, | ||
{ | ||
tag: [t.tagName], | ||
color: '#99d066', | ||
}, | ||
{ | ||
tag: [t.squareBracket], | ||
color: '#ff5f52', | ||
}, | ||
{ | ||
tag: [t.angleBracket], | ||
color: '#606f7a', | ||
}, | ||
{ | ||
tag: [t.attributeName], | ||
color: '#bdbdbd', | ||
}, | ||
{ | ||
tag: [t.regexp], | ||
color: '#ff5f52', | ||
}, | ||
{ | ||
tag: [t.quote], | ||
color: '#6abf69', | ||
}, | ||
{ tag: [t.string], color: '#99d066' }, | ||
{ | ||
tag: t.link, | ||
color: '#56c8d8', | ||
textDecoration: 'underline', | ||
textUnderlinePosition: 'under', | ||
}, | ||
{ | ||
tag: [t.url, t.escape, t.special(t.string)], | ||
color: '#facf4e', | ||
}, | ||
{ tag: [t.meta], color: '#707d8b' }, | ||
{ tag: [t.comment], color: '#707d8b', fontStyle: 'italic' }, | ||
{ tag: t.monospace, color: '#bdbdbd' }, | ||
{ tag: t.strong, fontWeight: 'bold', color: '#ff5f52' }, | ||
{ tag: t.emphasis, fontStyle: 'italic', color: '#99d066' }, | ||
{ tag: t.strikethrough, textDecoration: 'line-through' }, | ||
{ tag: t.heading, fontWeight: 'bold', color: '#facf4e' }, | ||
{ tag: t.heading1, fontWeight: 'bold', color: '#facf4e' }, | ||
{ | ||
tag: [t.heading2, t.heading3, t.heading4], | ||
fontWeight: 'bold', | ||
color: '#facf4e', | ||
}, | ||
{ | ||
tag: [t.heading5, t.heading6], | ||
color: '#facf4e', | ||
}, | ||
{ tag: [t.atom, t.bool, t.special(t.variableName)], color: '#56c8d8' }, | ||
{ | ||
tag: [t.processingInstruction, t.inserted], | ||
color: '#ff5f52', | ||
}, | ||
{ | ||
tag: [t.contentSeparator], | ||
color: '#56c8d8', | ||
}, | ||
{ tag: t.invalid, color: '#606f7a', borderBottom: `1px dotted #ff5f52` }, | ||
], | ||
}); |
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