|
@@ -1,52 +1,51 @@
|
|
|
-/* eslint-disable camelcase */
|
|
|
|
|
// Ref: https://github.com/craftzdog/cm6-themes/blob/main/packages/material-dark/src/index.ts
|
|
// Ref: https://github.com/craftzdog/cm6-themes/blob/main/packages/material-dark/src/index.ts
|
|
|
-import { HighlightStyle, syntaxHighlighting } from '@codemirror/language';
|
|
|
|
|
-import { Extension } from '@codemirror/state';
|
|
|
|
|
-import { EditorView } from '@codemirror/view';
|
|
|
|
|
-import { tags as t } from '@lezer/highlight';
|
|
|
|
|
|
|
+import { EditorView } from '@codemirror/view'
|
|
|
|
|
+import { Extension } from '@codemirror/state'
|
|
|
|
|
+import { HighlightStyle, syntaxHighlighting } from '@codemirror/language'
|
|
|
|
|
+import { tags as t } from '@lezer/highlight'
|
|
|
|
|
|
|
|
// Auther: stephen-liu-fipo
|
|
// Auther: stephen-liu-fipo
|
|
|
-const base00 = '#2e3235';
|
|
|
|
|
-const base01 = '#505d64';
|
|
|
|
|
-const base02 = '#606f7a';
|
|
|
|
|
-const base03 = '#707d8b';
|
|
|
|
|
-// base04 = '#a0a4ae',
|
|
|
|
|
-const base05 = '#bdbdbd';
|
|
|
|
|
-const base06 = '#e0e0e0';
|
|
|
|
|
-const base07 = '#fdf6e3';
|
|
|
|
|
-const base_red = '#ff5f52';
|
|
|
|
|
-const base_deeporange = '#ff6e40';
|
|
|
|
|
-const base_pink = '#fa5788';
|
|
|
|
|
-const base_yellow = '#facf4e';
|
|
|
|
|
-const base_orange = '#ffad42';
|
|
|
|
|
-const base_cyan = '#56c8d8';
|
|
|
|
|
-const base_indigo = '#7186f0';
|
|
|
|
|
-const base_purple = '#cf6edf';
|
|
|
|
|
-const base_green = '#6abf69';
|
|
|
|
|
-const base_lightgreen = '#99d066';
|
|
|
|
|
-const base_teal = '#4ebaaa';
|
|
|
|
|
-
|
|
|
|
|
-const invalid = base_red;
|
|
|
|
|
-// Adjust color
|
|
|
|
|
-const darkBackground = '#36383a';
|
|
|
|
|
-// Adjust color
|
|
|
|
|
-const highlightBackground = '#44494d';
|
|
|
|
|
-const background = base00;
|
|
|
|
|
-const tooltipBackground = base01;
|
|
|
|
|
-const selection = base01;
|
|
|
|
|
-// Change color
|
|
|
|
|
-const cursor = base05;
|
|
|
|
|
-
|
|
|
|
|
-// / The editor theme styles for Material Dark.
|
|
|
|
|
|
|
+const base00 = '#2e3235',
|
|
|
|
|
+ base01 = '#505d64',
|
|
|
|
|
+ base02 = '#606f7a',
|
|
|
|
|
+ base03 = '#707d8b',
|
|
|
|
|
+ // base04 = '#a0a4ae',
|
|
|
|
|
+ base05 = '#bdbdbd',
|
|
|
|
|
+ base06 = '#e0e0e0',
|
|
|
|
|
+ base07 = '#fdf6e3',
|
|
|
|
|
+ base_red = '#ff5f52',
|
|
|
|
|
+ base_deeporange = '#ff6e40',
|
|
|
|
|
+ base_pink = '#fa5788',
|
|
|
|
|
+ base_yellow = '#facf4e',
|
|
|
|
|
+ base_orange = '#ffad42',
|
|
|
|
|
+ base_cyan = '#56c8d8',
|
|
|
|
|
+ base_indigo = '#7186f0',
|
|
|
|
|
+ base_purple = '#cf6edf',
|
|
|
|
|
+ base_green = '#6abf69',
|
|
|
|
|
+ base_lightgreen = '#99d066',
|
|
|
|
|
+ base_teal = '#4ebaaa'
|
|
|
|
|
+
|
|
|
|
|
+const invalid = base_red,
|
|
|
|
|
+ // Adjust color
|
|
|
|
|
+ darkBackground = '#36383a',
|
|
|
|
|
+ // Adjust color
|
|
|
|
|
+ highlightBackground = '#44494d',
|
|
|
|
|
+ background = base00,
|
|
|
|
|
+ tooltipBackground = base01,
|
|
|
|
|
+ selection = base01,
|
|
|
|
|
+ // Change color
|
|
|
|
|
+ cursor = base05
|
|
|
|
|
+
|
|
|
|
|
+/// The editor theme styles for Material Dark.
|
|
|
export const materialDarkTheme = EditorView.theme(
|
|
export const materialDarkTheme = EditorView.theme(
|
|
|
{
|
|
{
|
|
|
'&': {
|
|
'&': {
|
|
|
color: base05,
|
|
color: base05,
|
|
|
- backgroundColor: background,
|
|
|
|
|
|
|
+ backgroundColor: background
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
'.cm-content': {
|
|
'.cm-content': {
|
|
|
- caretColor: cursor,
|
|
|
|
|
|
|
+ caretColor: cursor
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
'.cm-cursor, .cm-dropCursor': { borderLeftColor: cursor },
|
|
'.cm-cursor, .cm-dropCursor': { borderLeftColor: cursor },
|
|
@@ -59,72 +58,72 @@ export const materialDarkTheme = EditorView.theme(
|
|
|
|
|
|
|
|
'.cm-searchMatch': {
|
|
'.cm-searchMatch': {
|
|
|
outline: `1px solid ${base_yellow}`,
|
|
outline: `1px solid ${base_yellow}`,
|
|
|
- backgroundColor: 'transparent',
|
|
|
|
|
|
|
+ backgroundColor: 'transparent'
|
|
|
},
|
|
},
|
|
|
'.cm-searchMatch.cm-searchMatch-selected': {
|
|
'.cm-searchMatch.cm-searchMatch-selected': {
|
|
|
- backgroundColor: highlightBackground,
|
|
|
|
|
|
|
+ backgroundColor: highlightBackground
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
'.cm-activeLine': { backgroundColor: highlightBackground },
|
|
'.cm-activeLine': { backgroundColor: highlightBackground },
|
|
|
'.cm-selectionMatch': {
|
|
'.cm-selectionMatch': {
|
|
|
backgroundColor: darkBackground,
|
|
backgroundColor: darkBackground,
|
|
|
- outline: `1px solid ${base_teal}`,
|
|
|
|
|
|
|
+ outline: `1px solid ${base_teal}`
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
'&.cm-focused .cm-matchingBracket': {
|
|
'&.cm-focused .cm-matchingBracket': {
|
|
|
color: base06,
|
|
color: base06,
|
|
|
- outline: `1px solid ${base_teal}`,
|
|
|
|
|
|
|
+ outline: `1px solid ${base_teal}`
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
'&.cm-focused .cm-nonmatchingBracket': {
|
|
'&.cm-focused .cm-nonmatchingBracket': {
|
|
|
- color: base_red,
|
|
|
|
|
|
|
+ color: base_red
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
'.cm-gutters': {
|
|
'.cm-gutters': {
|
|
|
backgroundColor: base00,
|
|
backgroundColor: base00,
|
|
|
borderRight: '1px solid #4f5b66',
|
|
borderRight: '1px solid #4f5b66',
|
|
|
- color: base02,
|
|
|
|
|
|
|
+ color: base02
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
'.cm-activeLineGutter': {
|
|
'.cm-activeLineGutter': {
|
|
|
backgroundColor: highlightBackground,
|
|
backgroundColor: highlightBackground,
|
|
|
- color: base07,
|
|
|
|
|
|
|
+ color: base07
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
'.cm-foldPlaceholder': {
|
|
'.cm-foldPlaceholder': {
|
|
|
backgroundColor: 'transparent',
|
|
backgroundColor: 'transparent',
|
|
|
border: 'none',
|
|
border: 'none',
|
|
|
- color: '#ddd',
|
|
|
|
|
|
|
+ color: '#ddd'
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
'.cm-tooltip': {
|
|
'.cm-tooltip': {
|
|
|
border: 'none',
|
|
border: 'none',
|
|
|
- backgroundColor: tooltipBackground,
|
|
|
|
|
|
|
+ backgroundColor: tooltipBackground
|
|
|
},
|
|
},
|
|
|
'.cm-tooltip .cm-tooltip-arrow:before': {
|
|
'.cm-tooltip .cm-tooltip-arrow:before': {
|
|
|
borderTopColor: 'transparent',
|
|
borderTopColor: 'transparent',
|
|
|
- borderBottomColor: 'transparent',
|
|
|
|
|
|
|
+ borderBottomColor: 'transparent'
|
|
|
},
|
|
},
|
|
|
'.cm-tooltip .cm-tooltip-arrow:after': {
|
|
'.cm-tooltip .cm-tooltip-arrow:after': {
|
|
|
borderTopColor: tooltipBackground,
|
|
borderTopColor: tooltipBackground,
|
|
|
- borderBottomColor: tooltipBackground,
|
|
|
|
|
|
|
+ borderBottomColor: tooltipBackground
|
|
|
},
|
|
},
|
|
|
'.cm-tooltip-autocomplete': {
|
|
'.cm-tooltip-autocomplete': {
|
|
|
'& > ul > li[aria-selected]': {
|
|
'& > ul > li[aria-selected]': {
|
|
|
backgroundColor: highlightBackground,
|
|
backgroundColor: highlightBackground,
|
|
|
- color: base03,
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ color: base03
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
- { dark: true },
|
|
|
|
|
-);
|
|
|
|
|
|
|
+ { dark: true }
|
|
|
|
|
+)
|
|
|
|
|
|
|
|
-// / The highlighting style for code in the Material Dark theme.
|
|
|
|
|
|
|
+/// The highlighting style for code in the Material Dark theme.
|
|
|
export const materialDarkHighlightStyle = HighlightStyle.define([
|
|
export const materialDarkHighlightStyle = HighlightStyle.define([
|
|
|
{ tag: t.keyword, color: base_purple },
|
|
{ tag: t.keyword, color: base_purple },
|
|
|
{
|
|
{
|
|
|
tag: [t.name, t.deleted, t.character, t.macroName],
|
|
tag: [t.name, t.deleted, t.character, t.macroName],
|
|
|
- color: base_cyan,
|
|
|
|
|
|
|
+ color: base_cyan
|
|
|
},
|
|
},
|
|
|
{ tag: [t.propertyName], color: base_yellow },
|
|
{ tag: [t.propertyName], color: base_yellow },
|
|
|
{ tag: [t.variableName], color: base05 },
|
|
{ tag: [t.variableName], color: base05 },
|
|
@@ -132,60 +131,60 @@ export const materialDarkHighlightStyle = HighlightStyle.define([
|
|
|
{ tag: [t.labelName], color: base_purple },
|
|
{ tag: [t.labelName], color: base_purple },
|
|
|
{
|
|
{
|
|
|
tag: [t.color, t.constant(t.name), t.standard(t.name)],
|
|
tag: [t.color, t.constant(t.name), t.standard(t.name)],
|
|
|
- color: base_yellow,
|
|
|
|
|
|
|
+ color: base_yellow
|
|
|
},
|
|
},
|
|
|
{ tag: [t.definition(t.name), t.separator], color: base_pink },
|
|
{ tag: [t.definition(t.name), t.separator], color: base_pink },
|
|
|
{ tag: [t.brace], color: base_purple },
|
|
{ tag: [t.brace], color: base_purple },
|
|
|
{
|
|
{
|
|
|
tag: [t.annotation],
|
|
tag: [t.annotation],
|
|
|
- color: invalid,
|
|
|
|
|
|
|
+ color: invalid
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
tag: [t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace],
|
|
tag: [t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace],
|
|
|
- color: base_orange,
|
|
|
|
|
|
|
+ color: base_orange
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
tag: [t.typeName, t.className],
|
|
tag: [t.typeName, t.className],
|
|
|
- color: base_orange,
|
|
|
|
|
|
|
+ color: base_orange
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
tag: [t.operator, t.operatorKeyword],
|
|
tag: [t.operator, t.operatorKeyword],
|
|
|
- color: base_indigo,
|
|
|
|
|
|
|
+ color: base_indigo
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
tag: [t.tagName],
|
|
tag: [t.tagName],
|
|
|
- color: base_deeporange,
|
|
|
|
|
|
|
+ color: base_deeporange
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
tag: [t.squareBracket],
|
|
tag: [t.squareBracket],
|
|
|
- color: base_red,
|
|
|
|
|
|
|
+ color: base_red
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
tag: [t.angleBracket],
|
|
tag: [t.angleBracket],
|
|
|
- color: base02,
|
|
|
|
|
|
|
+ color: base02
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
tag: [t.attributeName],
|
|
tag: [t.attributeName],
|
|
|
- color: base05,
|
|
|
|
|
|
|
+ color: base05
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
tag: [t.regexp],
|
|
tag: [t.regexp],
|
|
|
- color: invalid,
|
|
|
|
|
|
|
+ color: invalid
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
tag: [t.quote],
|
|
tag: [t.quote],
|
|
|
- color: base_green,
|
|
|
|
|
|
|
+ color: base_green
|
|
|
},
|
|
},
|
|
|
{ tag: [t.string], color: base_lightgreen },
|
|
{ tag: [t.string], color: base_lightgreen },
|
|
|
{
|
|
{
|
|
|
tag: t.link,
|
|
tag: t.link,
|
|
|
color: base_cyan,
|
|
color: base_cyan,
|
|
|
textDecoration: 'underline',
|
|
textDecoration: 'underline',
|
|
|
- textUnderlinePosition: 'under',
|
|
|
|
|
|
|
+ textUnderlinePosition: 'under'
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
tag: [t.url, t.escape, t.special(t.string)],
|
|
tag: [t.url, t.escape, t.special(t.string)],
|
|
|
- color: base_yellow,
|
|
|
|
|
|
|
+ color: base_yellow
|
|
|
},
|
|
},
|
|
|
{ tag: [t.meta], color: base03 },
|
|
{ tag: [t.meta], color: base03 },
|
|
|
{ tag: [t.comment], color: base03, fontStyle: 'italic' },
|
|
{ tag: [t.comment], color: base03, fontStyle: 'italic' },
|
|
@@ -198,27 +197,27 @@ export const materialDarkHighlightStyle = HighlightStyle.define([
|
|
|
{
|
|
{
|
|
|
tag: [t.heading2, t.heading3, t.heading4],
|
|
tag: [t.heading2, t.heading3, t.heading4],
|
|
|
fontWeight: 'bold',
|
|
fontWeight: 'bold',
|
|
|
- color: base_yellow,
|
|
|
|
|
|
|
+ color: base_yellow
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
tag: [t.heading5, t.heading6],
|
|
tag: [t.heading5, t.heading6],
|
|
|
- color: base_yellow,
|
|
|
|
|
|
|
+ color: base_yellow
|
|
|
},
|
|
},
|
|
|
{ tag: [t.atom, t.bool, t.special(t.variableName)], color: base_cyan },
|
|
{ tag: [t.atom, t.bool, t.special(t.variableName)], color: base_cyan },
|
|
|
{
|
|
{
|
|
|
tag: [t.processingInstruction, t.inserted],
|
|
tag: [t.processingInstruction, t.inserted],
|
|
|
- color: base_red,
|
|
|
|
|
|
|
+ color: base_red
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
tag: [t.contentSeparator],
|
|
tag: [t.contentSeparator],
|
|
|
- color: base_cyan,
|
|
|
|
|
|
|
+ color: base_cyan
|
|
|
},
|
|
},
|
|
|
- { tag: t.invalid, color: base02, borderBottom: `1px dotted ${base_red}` },
|
|
|
|
|
-]);
|
|
|
|
|
|
|
+ { tag: t.invalid, color: base02, borderBottom: `1px dotted ${base_red}` }
|
|
|
|
|
+])
|
|
|
|
|
|
|
|
-// / Extension to enable the Material Dark theme (both the editor theme and
|
|
|
|
|
-// / the highlight style).
|
|
|
|
|
|
|
+/// Extension to enable the Material Dark theme (both the editor theme and
|
|
|
|
|
+/// the highlight style).
|
|
|
export const materialDark: Extension = [
|
|
export const materialDark: Extension = [
|
|
|
materialDarkTheme,
|
|
materialDarkTheme,
|
|
|
- syntaxHighlighting(materialDarkHighlightStyle),
|
|
|
|
|
-];
|
|
|
|
|
|
|
+ syntaxHighlighting(materialDarkHighlightStyle)
|
|
|
|
|
+]
|