@uiw/codemirror-theme-duotone
Version:
Theme duotone for CodeMirror.
106 lines • 3.02 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
/**
* @name duotone
* @author Bram de Haan
* by Bram de Haan, adapted from DuoTone themes by Simurai (http://simurai.com/projects/2016/01/01/duotone-themes)
*/
import { tags as t } from '@lezer/highlight';
import { createTheme } from '@uiw/codemirror-themes';
export var defaultSettingsDuotoneLight = {
background: '#faf8f5',
foreground: '#b29762',
caret: '#93abdc',
selection: '#e3dcce',
selectionMatch: '#e3dcce',
gutterBackground: '#faf8f5',
gutterForeground: '#cdc4b1',
gutterBorder: 'transparent',
lineHighlight: '#ddceb154'
};
export var douToneLightStyle = [{
tag: [t.comment, t.bracket],
color: '#b6ad9a'
}, {
tag: [t.atom, t.number, t.keyword, t.link, t.attributeName, t.quote],
color: '#063289'
}, {
tag: [t.emphasis, t.heading, t.tagName, t.propertyName, t.variableName],
color: '#2d2006'
}, {
tag: [t.typeName, t.url, t.string],
color: '#896724'
}, {
tag: [t.operator, t.string],
color: '#1659df'
}, {
tag: [t.propertyName],
color: '#b29762'
}, {
tag: [t.unit, t.punctuation],
color: '#063289'
}];
export var duotoneLightInit = 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 createTheme({
theme: theme,
settings: _extends({}, defaultSettingsDuotoneLight, settings),
styles: [...douToneLightStyle, ...styles]
});
};
export var duotoneLight = duotoneLightInit();
export var defaultSettingsDuotoneDark = {
background: '#2a2734',
foreground: '#6c6783',
caret: '#ffad5c',
selection: '#91ff6c26',
selectionMatch: '#91ff6c26',
gutterBackground: '#2a2734',
gutterForeground: '#545167',
lineHighlight: '#36334280'
};
export var duotoneDarkStyle = [{
tag: [t.comment, t.bracket],
color: '#6c6783'
}, {
tag: [t.atom, t.number, t.keyword, t.link, t.attributeName, t.quote],
color: '#ffcc99'
}, {
tag: [t.emphasis, t.heading, t.tagName, t.propertyName, t.className, t.variableName],
color: '#eeebff'
}, {
tag: [t.typeName, t.url],
color: '#7a63ee'
}, {
tag: t.operator,
color: '#ffad5c'
}, {
tag: t.string,
color: '#ffb870'
}, {
tag: [t.propertyName],
color: '#9a86fd'
}, {
tag: [t.unit, t.punctuation],
color: '#e09142'
}];
export var duotoneDarkInit = options => {
var _ref2 = options || {},
_ref2$theme = _ref2.theme,
theme = _ref2$theme === void 0 ? 'dark' : _ref2$theme,
_ref2$settings = _ref2.settings,
settings = _ref2$settings === void 0 ? {} : _ref2$settings,
_ref2$styles = _ref2.styles,
styles = _ref2$styles === void 0 ? [] : _ref2$styles;
return createTheme({
theme: theme,
settings: _extends({}, defaultSettingsDuotoneDark, settings),
styles: [...duotoneDarkStyle, ...styles]
});
};
export var duotoneDark = duotoneDarkInit();