@uiw/codemirror-theme-dracula
Advanced tools
Comparing version 4.17.1 to 4.18.0
@@ -0,1 +1,3 @@ | ||
import { CreateThemeOptions } from '@uiw/codemirror-themes'; | ||
export declare const draculaInit: (options?: CreateThemeOptions) => import("@codemirror/state").Extension; | ||
export declare const dracula: import("@codemirror/state").Extension; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"]; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.dracula = void 0; | ||
exports.draculaInit = exports.dracula = void 0; | ||
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _highlight = require("@lezer/highlight"); | ||
@@ -16,41 +19,52 @@ var _codemirrorThemes = require("@uiw/codemirror-themes"); | ||
var dracula = (0, _codemirrorThemes.createTheme)({ | ||
theme: 'dark', | ||
settings: { | ||
background: '#282a36', | ||
foreground: '#f8f8f2', | ||
caret: '#f8f8f0', | ||
selection: 'rgba(255, 255, 255, 0.1)', | ||
selectionMatch: 'rgba(255, 255, 255, 0.2)', | ||
gutterBackground: '#282a36', | ||
gutterForeground: '#6D8A88', | ||
lineHighlight: 'rgba(255, 255, 255, 0.1)' | ||
}, | ||
styles: [{ | ||
tag: _highlight.tags.comment, | ||
color: '#6272a4' | ||
}, { | ||
tag: _highlight.tags.string, | ||
color: '#f1fa8c' | ||
}, { | ||
tag: _highlight.tags.atom, | ||
color: '#bd93f9' | ||
}, { | ||
tag: _highlight.tags.meta, | ||
color: '#f8f8f2' | ||
}, { | ||
tag: [_highlight.tags.keyword, _highlight.tags.operator, _highlight.tags.tagName], | ||
color: '#ff79c6' | ||
}, { | ||
tag: [_highlight.tags["function"](_highlight.tags.propertyName), _highlight.tags.propertyName], | ||
color: '#66d9ef' | ||
}, { | ||
tag: [_highlight.tags.definition(_highlight.tags.variableName), _highlight.tags["function"](_highlight.tags.variableName), _highlight.tags.className, _highlight.tags.attributeName], | ||
color: '#50fa7b' | ||
}, { | ||
tag: _highlight.tags.atom, | ||
color: '#bd93f9' | ||
}] | ||
}); | ||
var draculaInit = function draculaInit(options) { | ||
var _ref = options || {}, | ||
_ref$theme = _ref.theme, | ||
theme = _ref$theme === void 0 ? 'light' : _ref$theme, | ||
_ref$settings = _ref.settings, | ||
settings = _ref$settings === void 0 ? {} : _ref$settings, | ||
_ref$styles = _ref.styles, | ||
styles = _ref$styles === void 0 ? [] : _ref$styles; | ||
return (0, _codemirrorThemes.createTheme)({ | ||
theme: theme, | ||
settings: (0, _objectSpread2["default"])({ | ||
background: '#282a36', | ||
foreground: '#f8f8f2', | ||
caret: '#f8f8f0', | ||
selection: 'rgba(255, 255, 255, 0.1)', | ||
selectionMatch: 'rgba(255, 255, 255, 0.2)', | ||
gutterBackground: '#282a36', | ||
gutterForeground: '#6D8A88', | ||
lineHighlight: 'rgba(255, 255, 255, 0.1)' | ||
}, settings), | ||
styles: [{ | ||
tag: _highlight.tags.comment, | ||
color: '#6272a4' | ||
}, { | ||
tag: _highlight.tags.string, | ||
color: '#f1fa8c' | ||
}, { | ||
tag: _highlight.tags.atom, | ||
color: '#bd93f9' | ||
}, { | ||
tag: _highlight.tags.meta, | ||
color: '#f8f8f2' | ||
}, { | ||
tag: [_highlight.tags.keyword, _highlight.tags.operator, _highlight.tags.tagName], | ||
color: '#ff79c6' | ||
}, { | ||
tag: [_highlight.tags["function"](_highlight.tags.propertyName), _highlight.tags.propertyName], | ||
color: '#66d9ef' | ||
}, { | ||
tag: [_highlight.tags.definition(_highlight.tags.variableName), _highlight.tags["function"](_highlight.tags.variableName), _highlight.tags.className, _highlight.tags.attributeName], | ||
color: '#50fa7b' | ||
}, { | ||
tag: _highlight.tags.atom, | ||
color: '#bd93f9' | ||
}].concat((0, _toConsumableArray2["default"])(styles)) | ||
}); | ||
}; | ||
exports.draculaInit = draculaInit; | ||
var dracula = draculaInit(); | ||
exports.dracula = dracula; | ||
//# sourceMappingURL=index.js.map |
@@ -0,1 +1,3 @@ | ||
import { CreateThemeOptions } from '@uiw/codemirror-themes'; | ||
export declare const draculaInit: (options?: CreateThemeOptions) => import("@codemirror/state").Extension; | ||
export declare const dracula: import("@codemirror/state").Extension; |
@@ -0,1 +1,2 @@ | ||
import _extends from "@babel/runtime/helpers/extends"; | ||
/** | ||
@@ -9,40 +10,48 @@ * @name dracula | ||
import { createTheme } from '@uiw/codemirror-themes'; | ||
export var dracula = createTheme({ | ||
theme: 'dark', | ||
settings: { | ||
background: '#282a36', | ||
foreground: '#f8f8f2', | ||
caret: '#f8f8f0', | ||
selection: 'rgba(255, 255, 255, 0.1)', | ||
selectionMatch: 'rgba(255, 255, 255, 0.2)', | ||
gutterBackground: '#282a36', | ||
gutterForeground: '#6D8A88', | ||
lineHighlight: 'rgba(255, 255, 255, 0.1)' | ||
}, | ||
styles: [{ | ||
tag: t.comment, | ||
color: '#6272a4' | ||
}, { | ||
tag: t.string, | ||
color: '#f1fa8c' | ||
}, { | ||
tag: t.atom, | ||
color: '#bd93f9' | ||
}, { | ||
tag: t.meta, | ||
color: '#f8f8f2' | ||
}, { | ||
tag: [t.keyword, t.operator, t.tagName], | ||
color: '#ff79c6' | ||
}, { | ||
tag: [t.function(t.propertyName), t.propertyName], | ||
color: '#66d9ef' | ||
}, { | ||
tag: [t.definition(t.variableName), t.function(t.variableName), t.className, t.attributeName], | ||
color: '#50fa7b' | ||
}, { | ||
tag: t.atom, | ||
color: '#bd93f9' | ||
}] | ||
}); | ||
export var draculaInit = options => { | ||
var { | ||
theme = 'light', | ||
settings = {}, | ||
styles = [] | ||
} = options || {}; | ||
return createTheme({ | ||
theme: theme, | ||
settings: _extends({ | ||
background: '#282a36', | ||
foreground: '#f8f8f2', | ||
caret: '#f8f8f0', | ||
selection: 'rgba(255, 255, 255, 0.1)', | ||
selectionMatch: 'rgba(255, 255, 255, 0.2)', | ||
gutterBackground: '#282a36', | ||
gutterForeground: '#6D8A88', | ||
lineHighlight: 'rgba(255, 255, 255, 0.1)' | ||
}, settings), | ||
styles: [{ | ||
tag: t.comment, | ||
color: '#6272a4' | ||
}, { | ||
tag: t.string, | ||
color: '#f1fa8c' | ||
}, { | ||
tag: t.atom, | ||
color: '#bd93f9' | ||
}, { | ||
tag: t.meta, | ||
color: '#f8f8f2' | ||
}, { | ||
tag: [t.keyword, t.operator, t.tagName], | ||
color: '#ff79c6' | ||
}, { | ||
tag: [t.function(t.propertyName), t.propertyName], | ||
color: '#66d9ef' | ||
}, { | ||
tag: [t.definition(t.variableName), t.function(t.variableName), t.className, t.attributeName], | ||
color: '#50fa7b' | ||
}, { | ||
tag: t.atom, | ||
color: '#bd93f9' | ||
}, ...styles] | ||
}); | ||
}; | ||
export var dracula = draculaInit(); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@uiw/codemirror-theme-dracula", | ||
"version": "4.17.1", | ||
"version": "4.18.0", | ||
"description": "Theme dracula for CodeMirror.", | ||
@@ -24,3 +24,3 @@ "homepage": "https://uiwjs.github.io/react-codemirror/#/theme/data/dracula", | ||
"dependencies": { | ||
"@uiw/codemirror-themes": "4.17.1" | ||
"@uiw/codemirror-themes": "4.18.0" | ||
}, | ||
@@ -27,0 +27,0 @@ "keywords": [ |
@@ -19,2 +19,28 @@ <!--rehype:ignore:start--> | ||
```jsx | ||
import { tags as t } from '@lezer/highlight'; | ||
import { dracula, draculaInit } from '@uiw/codemirror-theme-dracula'; | ||
<CodeMirror theme={dracula} /> | ||
<CodeMirror | ||
theme={draculaInit({ | ||
settings: { | ||
caret: '#c6c6c6', | ||
fontFamily: 'monospace', | ||
}, | ||
styles: [ | ||
{ tag: t.comment, color: '#6272a4' }, | ||
] | ||
})} | ||
/> | ||
``` | ||
## API | ||
```tsx | ||
import { CreateThemeOptions } from '@uiw/codemirror-themes'; | ||
export declare const draculaInit: (options?: CreateThemeOptions) => import('@codemirror/state').Extension; | ||
export declare const dracula: import('@codemirror/state').Extension; | ||
``` | ||
## Usage | ||
@@ -21,0 +47,0 @@ |
@@ -8,26 +8,36 @@ /** | ||
import { tags as t } from '@lezer/highlight'; | ||
import { createTheme } from '@uiw/codemirror-themes'; | ||
import { createTheme, CreateThemeOptions } from '@uiw/codemirror-themes'; | ||
export const dracula = createTheme({ | ||
theme: 'dark', | ||
settings: { | ||
background: '#282a36', | ||
foreground: '#f8f8f2', | ||
caret: '#f8f8f0', | ||
selection: 'rgba(255, 255, 255, 0.1)', | ||
selectionMatch: 'rgba(255, 255, 255, 0.2)', | ||
gutterBackground: '#282a36', | ||
gutterForeground: '#6D8A88', | ||
lineHighlight: 'rgba(255, 255, 255, 0.1)', | ||
}, | ||
styles: [ | ||
{ tag: t.comment, color: '#6272a4' }, | ||
{ tag: t.string, color: '#f1fa8c' }, | ||
{ tag: t.atom, color: '#bd93f9' }, | ||
{ tag: t.meta, color: '#f8f8f2' }, | ||
{ tag: [t.keyword, t.operator, t.tagName], color: '#ff79c6' }, | ||
{ tag: [t.function(t.propertyName), t.propertyName], color: '#66d9ef' }, | ||
{ tag: [t.definition(t.variableName), t.function(t.variableName), t.className, t.attributeName], color: '#50fa7b' }, | ||
{ tag: t.atom, color: '#bd93f9' }, | ||
], | ||
}); | ||
export const draculaInit = (options?: CreateThemeOptions) => { | ||
const { theme = 'light', settings = {}, styles = [] } = options || {}; | ||
return createTheme({ | ||
theme: theme, | ||
settings: { | ||
background: '#282a36', | ||
foreground: '#f8f8f2', | ||
caret: '#f8f8f0', | ||
selection: 'rgba(255, 255, 255, 0.1)', | ||
selectionMatch: 'rgba(255, 255, 255, 0.2)', | ||
gutterBackground: '#282a36', | ||
gutterForeground: '#6D8A88', | ||
lineHighlight: 'rgba(255, 255, 255, 0.1)', | ||
...settings, | ||
}, | ||
styles: [ | ||
{ tag: t.comment, color: '#6272a4' }, | ||
{ tag: t.string, color: '#f1fa8c' }, | ||
{ tag: t.atom, color: '#bd93f9' }, | ||
{ tag: t.meta, color: '#f8f8f2' }, | ||
{ tag: [t.keyword, t.operator, t.tagName], color: '#ff79c6' }, | ||
{ tag: [t.function(t.propertyName), t.propertyName], color: '#66d9ef' }, | ||
{ | ||
tag: [t.definition(t.variableName), t.function(t.variableName), t.className, t.attributeName], | ||
color: '#50fa7b', | ||
}, | ||
{ tag: t.atom, color: '#bd93f9' }, | ||
...styles, | ||
], | ||
}); | ||
}; | ||
export const dracula = draculaInit(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
16044
167
98
+ Added@uiw/codemirror-themes@4.18.0(transitive)
- Removed@uiw/codemirror-themes@4.17.1(transitive)