Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(theme): add noctis-lilac theme.
- Loading branch information
1 parent
fea984f
commit f30c552
Showing
11 changed files
with
251 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<!--rehype:ignore:start--> | ||
|
||
# NoctisLilac Theme | ||
|
||
<!--rehype:ignore:end--> | ||
|
||
[![npm version](https://img.shields.io/npm/v/@uiw/codemirror-theme-noctis-lilac.svg)](https://www.npmjs.com/package/@uiw/codemirror-theme-noctis-lilac) | ||
|
||
This package implements the [nord theme](https://www.nordtheme.com/) for the CodeMirror code editor. | ||
|
||
<a href="https://uiwjs.github.io/react-codemirror/#/theme/data/noctis-lilac"> | ||
<img width="436" alt="codemirror-theme-nord" src="https://user-images.githubusercontent.com/1680273/206086882-b3525159-d987-4d7f-bad3-fdf3d4dbd06f.png"> | ||
</a> | ||
|
||
## Install | ||
|
||
```bash | ||
npm install @uiw/codemirror-theme-noctis-lilac --save | ||
``` | ||
|
||
```jsx | ||
import { noctisLilac, noctisLilacInit } from '@uiw/codemirror-theme-noctis-lilac'; | ||
|
||
<CodeMirror theme={noctisLilac} /> | ||
<CodeMirror | ||
theme={noctisLilacInit({ | ||
settings: { | ||
caret: '#c6c6c6', | ||
fontFamily: 'monospace', | ||
} | ||
})} | ||
/> | ||
``` | ||
|
||
## API | ||
|
||
```tsx | ||
import { CreateThemeOptions } from '@uiw/codemirror-themes'; | ||
export declare const noctisLilacInit: (options?: CreateThemeOptions) => import('@codemirror/state').Extension; | ||
export declare const noctisLilac: import('@codemirror/state').Extension; | ||
``` | ||
|
||
## Usage | ||
|
||
```jsx | ||
import CodeMirror from '@uiw/react-codemirror'; | ||
import { noctisLilac } from '@uiw/codemirror-theme-noctis-lilac'; | ||
import { javascript } from '@codemirror/lang-javascript'; | ||
|
||
function App() { | ||
return ( | ||
<CodeMirror | ||
value="console.log('hello world!');" | ||
height="200px" | ||
theme={noctisLilac} | ||
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 { noctisLilac } from '@uiw/codemirror-theme-noctis-lilac'; | ||
|
||
const state = EditorState.create({ | ||
doc: 'my source code', | ||
extensions: [noctisLilac, 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-noctis-lilac", | ||
"version": "4.18.0", | ||
"description": "Theme noctis-lilac for CodeMirror.", | ||
"homepage": "https://uiwjs.github.io/react-codemirror/#/theme/data/noctis-lilac", | ||
"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.0" | ||
}, | ||
"keywords": [ | ||
"codemirror", | ||
"codemirror6", | ||
"theme", | ||
"noctis-lilac", | ||
"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,86 @@ | ||
import { tags as t } from '@lezer/highlight'; | ||
import { createTheme, CreateThemeOptions } from '@uiw/codemirror-themes'; | ||
|
||
export const noctisLilacInit = (options?: CreateThemeOptions) => { | ||
const { theme = 'light', settings = {}, styles = [] } = options || {}; | ||
return createTheme({ | ||
theme: theme, | ||
settings: { | ||
background: '#f2f1f8', | ||
foreground: '#0c006b', | ||
caret: '#5c49e9', | ||
selection: '#d5d1f2', | ||
selectionMatch: '#d5d1f2', | ||
gutterBackground: '#f2f1f8', | ||
gutterForeground: '#0c006b70', | ||
lineHighlight: '#e1def3', | ||
...settings, | ||
}, | ||
styles: [ | ||
{ | ||
tag: t.comment, | ||
color: '#9995b7', | ||
}, | ||
{ | ||
tag: t.keyword, | ||
color: '#ff5792', | ||
fontWeight: 'bold', | ||
}, | ||
{ | ||
tag: [t.definitionKeyword, t.modifier], | ||
color: '#ff5792', | ||
}, | ||
{ | ||
tag: [t.className, t.tagName, t.definition(t.typeName)], | ||
color: '#0094f0', | ||
}, | ||
{ | ||
tag: [t.number, t.bool, t.null, t.special(t.brace)], | ||
color: '#5842ff', | ||
}, | ||
{ | ||
tag: [t.definition(t.propertyName), t.function(t.variableName)], | ||
color: '#0095a8', | ||
}, | ||
{ | ||
tag: t.typeName, | ||
color: '#b3694d', | ||
}, | ||
{ | ||
tag: [t.propertyName, t.variableName], | ||
color: '#fa8900', | ||
}, | ||
{ | ||
tag: t.operator, | ||
color: '#ff5792', | ||
}, | ||
{ | ||
tag: t.self, | ||
color: '#e64100', | ||
}, | ||
{ | ||
tag: [t.string, t.regexp], | ||
color: '#00b368', | ||
}, | ||
{ | ||
tag: [t.paren, t.bracket], | ||
color: '#0431fa', | ||
}, | ||
{ | ||
tag: t.labelName, | ||
color: '#00bdd6', | ||
}, | ||
{ | ||
tag: t.attributeName, | ||
color: '#e64100', | ||
}, | ||
{ | ||
tag: t.angleBracket, | ||
color: '#9995b7', | ||
}, | ||
...styles, | ||
], | ||
}); | ||
}; | ||
|
||
export const noctisLilac = noctisLilacInit(); |
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