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
6d1e81c
commit e7c7f0f
Showing
16 changed files
with
214 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,97 @@ | ||
<!--rehype:ignore:start--> | ||
|
||
# BBEdit Theme | ||
|
||
<!--rehype:ignore:end--> | ||
|
||
[![npm version](https://img.shields.io/npm/v/@uiw/codemirror-theme-aura.svg)](https://www.npmjs.com/package/@uiw/codemirror-theme-aura) | ||
|
||
<a href="https://uiwjs.github.io/react-codemirror/#/theme/data/aura"> | ||
<img width="436" alt="codemirror-theme-aura" src="https://user-images.githubusercontent.com/1680273/206092773-8140fc6b-119f-4271-a821-7dc6bcbc1c63.png"> | ||
</a> | ||
|
||
## Install | ||
|
||
```bash | ||
npm install @uiw/codemirror-theme-aura --save | ||
``` | ||
|
||
```jsx | ||
import { tags as t } from '@lezer/highlight'; | ||
import { aura, auraInit } from '@uiw/codemirror-theme-aura'; | ||
|
||
<CodeMirror theme={aura} /> | ||
<CodeMirror | ||
theme={auraInit({ | ||
settings: { | ||
caret: '#c6c6c6', | ||
fontFamily: 'monospace', | ||
}, | ||
styles: [ | ||
{ tag: t.comment, color: '#6272a4' }, | ||
] | ||
})} | ||
/> | ||
``` | ||
|
||
## API | ||
|
||
```tsx | ||
import { CreateThemeOptions } from '@uiw/codemirror-themes'; | ||
export declare const auraInit: (options?: CreateThemeOptions) => import('@codemirror/state').Extension; | ||
export declare const aura: import('@codemirror/state').Extension; | ||
``` | ||
|
||
## Usage | ||
|
||
```jsx | ||
import CodeMirror from '@uiw/react-codemirror'; | ||
import { aura } from '@uiw/codemirror-theme-aura'; | ||
import { javascript } from '@codemirror/lang-javascript'; | ||
|
||
function App() { | ||
return ( | ||
<CodeMirror | ||
value="console.log('hello world!');" | ||
height="200px" | ||
theme={aura} | ||
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 { aura } from '@uiw/codemirror-theme-aura'; | ||
|
||
const state = EditorState.create({ | ||
doc: 'my source code', | ||
extensions: [aura, 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-aura", | ||
"version": "4.18.2", | ||
"description": "Theme aura for CodeMirror.", | ||
"homepage": "https://uiwjs.github.io/react-codemirror/#/theme/data/aura", | ||
"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.18.2" | ||
}, | ||
"keywords": [ | ||
"codemirror", | ||
"codemirror6", | ||
"theme", | ||
"aura", | ||
"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,46 @@ | ||
import { tags as t } from '@lezer/highlight'; | ||
import { createTheme, CreateThemeOptions } from '@uiw/codemirror-themes'; | ||
|
||
export const auraInit = (options?: CreateThemeOptions) => { | ||
const { theme = 'dark', settings = {}, styles = [] } = options || {}; | ||
return createTheme({ | ||
theme: theme, | ||
settings: { | ||
background: '#21202e', | ||
foreground: '#edecee', | ||
caret: '#a277ff', | ||
selection: '#3d375e7f', | ||
selectionMatch: '#3d375e7f', | ||
gutterBackground: '#21202e', | ||
gutterForeground: '#edecee', | ||
gutterBorder: 'transparent', | ||
lineHighlight: '#a394f033', | ||
...settings, | ||
}, | ||
styles: [ | ||
{ tag: t.keyword, color: '#a277ff' }, | ||
{ tag: [t.name, t.deleted, t.character, t.macroName], color: '#edecee' }, | ||
{ tag: [t.propertyName], color: '#ffca85' }, | ||
{ tag: [t.processingInstruction, t.string, t.inserted, t.special(t.string)], color: '#61ffca' }, | ||
{ tag: [t.function(t.variableName), t.labelName], color: '#ffca85' }, | ||
{ tag: [t.color, t.constant(t.name), t.standard(t.name)], color: '#61ffca' }, | ||
{ tag: [t.definition(t.name), t.separator], color: '#edecee' }, | ||
{ tag: [t.className], color: '#82e2ff' }, | ||
{ tag: [t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace], color: '#61ffca' }, | ||
{ tag: [t.typeName], color: '#82e2ff' }, | ||
{ tag: [t.operator, t.operatorKeyword], color: '#a277ff' }, | ||
{ tag: [t.url, t.escape, t.regexp, t.link], color: '#61ffca' }, | ||
{ tag: [t.meta, t.comment], color: '#6d6d6d' }, | ||
{ tag: t.strong, fontWeight: 'bold' }, | ||
{ tag: t.emphasis, fontStyle: 'italic' }, | ||
{ tag: t.link, textDecoration: 'underline' }, | ||
{ tag: t.heading, fontWeight: 'bold', color: '#a277ff' }, | ||
{ tag: [t.atom, t.bool, t.special(t.variableName)], color: '#edecee' }, | ||
{ tag: t.invalid, color: '#ff6767' }, | ||
{ tag: t.strikethrough, textDecoration: 'line-through' }, | ||
...styles, | ||
], | ||
}); | ||
}; | ||
|
||
export const aura = auraInit(); |
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
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