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
18c1977
commit d6899db
Showing
13 changed files
with
367 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
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,74 @@ | ||
<!--rehype:ignore:start--> | ||
|
||
# Solarized Theme | ||
|
||
<!--rehype:ignore:end--> | ||
|
||
[![npm version](https://img.shields.io/npm/v/@uiw/codemirror-theme-solarized.svg)](https://www.npmjs.com/package/@uiw/codemirror-theme-solarized) | ||
|
||
This package implements the [Solarized](https://ethanschoonover.com/solarized/) theme for the CodeMirror code editor. | ||
|
||
<a href="https://uiwjs.github.io/react-codemirror/#/theme/data/solarized/light"> | ||
<img width="436" alt="codemirror-theme-solarized" src="https://user-images.githubusercontent.com/1680273/205544435-a080d1d4-6da9-4f1d-aa10-5f2207d31176.png"> | ||
</a> | ||
|
||
<a href="https://uiwjs.github.io/react-codemirror/#/theme/data/solarized/dark"> | ||
<img width="436" alt="codemirror-theme-solarized" src="https://user-images.githubusercontent.com/1680273/205547403-96db62c3-d061-4dee-88d0-c86ed17e7489.png"> | ||
</a> | ||
|
||
## Install | ||
|
||
```bash | ||
npm install @uiw/codemirror-theme-solarized --save | ||
``` | ||
|
||
## Usage | ||
|
||
```jsx | ||
import CodeMirror from '@uiw/react-codemirror'; | ||
import { solarizedLight, solarizedDark } from '@uiw/codemirror-theme-solarized'; | ||
import { javascript } from '@codemirror/lang-javascript'; | ||
|
||
function App() { | ||
return ( | ||
<CodeMirror | ||
value="console.log('hello world!');" | ||
height="200px" | ||
theme={solarizedLight} | ||
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 { solarizedLight, solarizedDark } from '@uiw/codemirror-theme-solarized'; | ||
|
||
const state = EditorState.create({ | ||
doc: 'my source code', | ||
extensions: [solarizedLight, 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-solarized", | ||
"version": "4.16.0", | ||
"description": "Theme solarized for CodeMirror.", | ||
"homepage": "https://uiwjs.github.io/react-codemirror/#/theme/data/solarized", | ||
"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", | ||
"solarized", | ||
"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,216 @@ | ||
import { tags as t } from '@lezer/highlight'; | ||
import { createTheme } from '@uiw/codemirror-themes'; | ||
|
||
export const solarizedLight = createTheme({ | ||
theme: 'light', | ||
settings: { | ||
background: '#fdf6e3', | ||
foreground: '#657b83', | ||
caret: '#586e75', | ||
selection: '#dfd9c8', | ||
selectionMatch: '#dfd9c8', | ||
gutterBackground: '#00000010', | ||
gutterForeground: '#657b83', | ||
lineHighlight: '#dfd9c8', | ||
}, | ||
styles: [ | ||
{ tag: t.keyword, color: '#859900' }, | ||
{ | ||
tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName], | ||
color: '#2aa198', | ||
}, | ||
{ tag: [t.variableName], color: '#268bd2' }, | ||
{ tag: [t.function(t.variableName)], color: '#268bd2' }, | ||
{ tag: [t.labelName], color: '#d33682' }, | ||
{ | ||
tag: [t.color, t.constant(t.name), t.standard(t.name)], | ||
color: '#b58900', | ||
}, | ||
{ tag: [t.definition(t.name), t.separator], color: '#2aa198' }, | ||
{ tag: [t.brace], color: '#d33682' }, | ||
{ | ||
tag: [t.annotation], | ||
color: '#d30102', | ||
}, | ||
{ | ||
tag: [t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace], | ||
color: '#d33682', | ||
}, | ||
{ | ||
tag: [t.typeName, t.className], | ||
color: '#cb4b16', | ||
}, | ||
{ | ||
tag: [t.operator, t.operatorKeyword], | ||
color: '#6c71c4', | ||
}, | ||
{ | ||
tag: [t.tagName], | ||
color: '#268bd2', | ||
}, | ||
{ | ||
tag: [t.squareBracket], | ||
color: '#dc322f', | ||
}, | ||
{ | ||
tag: [t.angleBracket], | ||
color: '#073642', | ||
}, | ||
{ | ||
tag: [t.attributeName], | ||
color: '#93a1a1', | ||
}, | ||
{ | ||
tag: [t.regexp], | ||
color: '#d30102', | ||
}, | ||
{ | ||
tag: [t.quote], | ||
color: '#859900', | ||
}, | ||
{ tag: [t.string], color: '#b58900' }, | ||
{ | ||
tag: t.link, | ||
color: '#2aa198', | ||
textDecoration: 'underline', | ||
textUnderlinePosition: 'under', | ||
}, | ||
{ | ||
tag: [t.url, t.escape, t.special(t.string)], | ||
color: '#b58900', | ||
}, | ||
{ tag: [t.meta], color: '#dc322f' }, | ||
{ tag: [t.comment], color: '#586e75', fontStyle: 'italic' }, | ||
{ tag: t.strong, fontWeight: 'bold', color: '#586e75' }, | ||
{ tag: t.emphasis, fontStyle: 'italic', color: '#859900' }, | ||
{ tag: t.strikethrough, textDecoration: 'line-through' }, | ||
{ tag: t.heading, fontWeight: 'bold', color: '#b58900' }, | ||
{ tag: t.heading1, fontWeight: 'bold', color: '#002b36' }, | ||
{ | ||
tag: [t.heading2, t.heading3, t.heading4], | ||
fontWeight: 'bold', | ||
color: '#002b36', | ||
}, | ||
{ | ||
tag: [t.heading5, t.heading6], | ||
color: '#002b36', | ||
}, | ||
{ tag: [t.atom, t.bool, t.special(t.variableName)], color: '#d33682' }, | ||
{ | ||
tag: [t.processingInstruction, t.inserted, t.contentSeparator], | ||
color: '#dc322f', | ||
}, | ||
{ | ||
tag: [t.contentSeparator], | ||
color: '#b58900', | ||
}, | ||
{ tag: t.invalid, color: '#073642', borderBottom: `1px dotted #dc322f` }, | ||
], | ||
}); | ||
|
||
export const solarizedDark = createTheme({ | ||
theme: 'dark', | ||
settings: { | ||
background: '#002b36', | ||
foreground: '#93a1a1', | ||
caret: '#839496', | ||
selection: '#173541', | ||
selectionMatch: '#aafe661a', | ||
gutterBackground: '#00252f', | ||
gutterForeground: '#839496', | ||
lineHighlight: '#173541', | ||
}, | ||
styles: [ | ||
{ tag: t.keyword, color: '#859900' }, | ||
{ | ||
tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName], | ||
color: '#2aa198', | ||
}, | ||
{ tag: [t.variableName], color: '#93a1a1' }, | ||
{ tag: [t.function(t.variableName)], color: '#268bd2' }, | ||
{ tag: [t.labelName], color: '#d33682' }, | ||
{ | ||
tag: [t.color, t.constant(t.name), t.standard(t.name)], | ||
color: '#b58900', | ||
}, | ||
{ tag: [t.definition(t.name), t.separator], color: '#2aa198' }, | ||
{ tag: [t.brace], color: '#d33682' }, | ||
{ | ||
tag: [t.annotation], | ||
color: '#d30102', | ||
}, | ||
{ | ||
tag: [t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace], | ||
color: '#d33682', | ||
}, | ||
{ | ||
tag: [t.typeName, t.className], | ||
color: '#cb4b16', | ||
}, | ||
{ | ||
tag: [t.operator, t.operatorKeyword], | ||
color: '#6c71c4', | ||
}, | ||
{ | ||
tag: [t.tagName], | ||
color: '#268bd2', | ||
}, | ||
{ | ||
tag: [t.squareBracket], | ||
color: '#dc322f', | ||
}, | ||
{ | ||
tag: [t.angleBracket], | ||
color: '#586e75', | ||
}, | ||
{ | ||
tag: [t.attributeName], | ||
color: '#93a1a1', | ||
}, | ||
{ | ||
tag: [t.regexp], | ||
color: '#d30102', | ||
}, | ||
{ | ||
tag: [t.quote], | ||
color: '#859900', | ||
}, | ||
{ tag: [t.string], color: '#b58900' }, | ||
{ | ||
tag: t.link, | ||
color: '#2aa198', | ||
textDecoration: 'underline', | ||
textUnderlinePosition: 'under', | ||
}, | ||
{ | ||
tag: [t.url, t.escape, t.special(t.string)], | ||
color: '#b58900', | ||
}, | ||
{ tag: [t.meta], color: '#dc322f' }, | ||
{ tag: [t.comment], color: '#586e75', fontStyle: 'italic' }, | ||
{ tag: t.strong, fontWeight: 'bold', color: '#eee8d5' }, | ||
{ tag: t.emphasis, fontStyle: 'italic', color: '#859900' }, | ||
{ tag: t.strikethrough, textDecoration: 'line-through' }, | ||
{ tag: t.heading, fontWeight: 'bold', color: '#b58900' }, | ||
{ tag: t.heading1, fontWeight: 'bold', color: '#fdf6e3' }, | ||
{ | ||
tag: [t.heading2, t.heading3, t.heading4], | ||
fontWeight: 'bold', | ||
color: '#eee8d5', | ||
}, | ||
{ | ||
tag: [t.heading5, t.heading6], | ||
color: '#eee8d5', | ||
}, | ||
{ tag: [t.atom, t.bool, t.special(t.variableName)], color: '#d33682' }, | ||
{ | ||
tag: [t.processingInstruction, t.inserted, t.contentSeparator], | ||
color: '#dc322f', | ||
}, | ||
{ | ||
tag: [t.contentSeparator], | ||
color: '#b58900', | ||
}, | ||
{ tag: t.invalid, color: '#586e75', borderBottom: `1px dotted #dc322f` }, | ||
], | ||
}); |
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 | ||
} | ||
} |
Oops, something went wrong.