UNPKG

@uiw/codemirror-theme-nord

Version:
159 lines (157 loc) 4.83 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"]; Object.defineProperty(exports, "__esModule", { value: true }); exports.nordInit = exports.nordDarkStyle = exports.nord = exports.defaultSettingsNord = void 0; var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); var _highlight = require("@lezer/highlight"); var _codemirrorThemes = require("@uiw/codemirror-themes"); var defaultSettingsNord = exports.defaultSettingsNord = { background: '#2e3440', foreground: '#FFFFFF', caret: '#FFFFFF', selection: '#00000073', selectionMatch: '#00000073', gutterBackground: '#2e3440', gutterForeground: '#4c566a', gutterActiveForeground: '#d8dee9', lineHighlight: '#4c566a29' }; var nordDarkStyle = exports.nordDarkStyle = [{ tag: _highlight.tags.keyword, color: '#5e81ac' }, { tag: [_highlight.tags.name, _highlight.tags.deleted, _highlight.tags.character, _highlight.tags.propertyName, _highlight.tags.macroName], color: '#88c0d0' }, { tag: [_highlight.tags.variableName], color: '#8fbcbb' }, { tag: [_highlight.tags["function"](_highlight.tags.variableName)], color: '#8fbcbb' }, { tag: [_highlight.tags.labelName], color: '#81a1c1' }, { tag: [_highlight.tags.color, _highlight.tags.constant(_highlight.tags.name), _highlight.tags.standard(_highlight.tags.name)], color: '#5e81ac' }, { tag: [_highlight.tags.definition(_highlight.tags.name), _highlight.tags.separator], color: '#a3be8c' }, { tag: [_highlight.tags.brace], color: '#8fbcbb' }, { tag: [_highlight.tags.annotation], color: '#d30102' }, { tag: [_highlight.tags.number, _highlight.tags.changed, _highlight.tags.annotation, _highlight.tags.modifier, _highlight.tags.self, _highlight.tags.namespace], color: '#b48ead' }, { tag: [_highlight.tags.typeName, _highlight.tags.className], color: '#ebcb8b' }, { tag: [_highlight.tags.operator, _highlight.tags.operatorKeyword], color: '#a3be8c' }, { tag: [_highlight.tags.tagName], color: '#b48ead' }, { tag: [_highlight.tags.squareBracket], color: '#bf616a' }, { tag: [_highlight.tags.angleBracket], color: '#d08770' }, { tag: [_highlight.tags.attributeName], color: '#ebcb8b' }, { tag: [_highlight.tags.regexp], color: '#5e81ac' }, { tag: [_highlight.tags.quote], color: '#b48ead' }, { tag: [_highlight.tags.string], color: '#a3be8c' }, { tag: _highlight.tags.link, color: '#a3be8c', textDecoration: 'underline', textUnderlinePosition: 'under' }, { tag: [_highlight.tags.url, _highlight.tags.escape, _highlight.tags.special(_highlight.tags.string)], color: '#8fbcbb' }, { tag: [_highlight.tags.meta], color: '#88c0d0' }, { tag: [_highlight.tags.monospace], color: '#d8dee9', fontStyle: 'italic' }, { tag: [_highlight.tags.comment], color: '#4c566a', fontStyle: 'italic' }, { tag: _highlight.tags.strong, fontWeight: 'bold', color: '#5e81ac' }, { tag: _highlight.tags.emphasis, fontStyle: 'italic', color: '#5e81ac' }, { tag: _highlight.tags.strikethrough, textDecoration: 'line-through' }, { tag: _highlight.tags.heading, fontWeight: 'bold', color: '#5e81ac' }, { tag: _highlight.tags.special(_highlight.tags.heading1), fontWeight: 'bold', color: '#5e81ac' }, { tag: _highlight.tags.heading1, fontWeight: 'bold', color: '#5e81ac' }, { tag: [_highlight.tags.heading2, _highlight.tags.heading3, _highlight.tags.heading4], fontWeight: 'bold', color: '#5e81ac' }, { tag: [_highlight.tags.heading5, _highlight.tags.heading6], color: '#5e81ac' }, { tag: [_highlight.tags.atom, _highlight.tags.bool, _highlight.tags.special(_highlight.tags.variableName)], color: '#d08770' }, { tag: [_highlight.tags.processingInstruction, _highlight.tags.inserted], color: '#8fbcbb' }, { tag: [_highlight.tags.contentSeparator], color: '#ebcb8b' }, { tag: _highlight.tags.invalid, color: '#434c5e', borderBottom: "1px dotted #d30102" }]; // Colors from https://www.nordtheme.com/docs/colors-and-palettes var nordInit = exports.nordInit = function nordInit(options) { var _ref = options || {}, _ref$theme = _ref.theme, theme = _ref$theme === void 0 ? 'dark' : _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"])((0, _objectSpread2["default"])({}, defaultSettingsNord), settings), styles: [].concat(nordDarkStyle, (0, _toConsumableArray2["default"])(styles)) }); }; var nord = exports.nord = nordInit();