aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/editor/EditorTheme.ts
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/frontend/src/editor/EditorTheme.ts')
-rw-r--r--subprojects/frontend/src/editor/EditorTheme.ts38
1 files changed, 35 insertions, 3 deletions
diff --git a/subprojects/frontend/src/editor/EditorTheme.ts b/subprojects/frontend/src/editor/EditorTheme.ts
index 9f560dfb..1cad4a36 100644
--- a/subprojects/frontend/src/editor/EditorTheme.ts
+++ b/subprojects/frontend/src/editor/EditorTheme.ts
@@ -1,5 +1,5 @@
1/* 1/*
2 * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> 2 * SPDX-FileCopyrightText: 2021-2024 The Refinery Authors <https://refinery.tools/>
3 * 3 *
4 * SPDX-License-Identifier: EPL-2.0 4 * SPDX-License-Identifier: EPL-2.0
5 */ 5 */
@@ -8,10 +8,35 @@ import cancelSVG from '@material-icons/svg/svg/cancel/baseline.svg?raw';
8import expandMoreSVG from '@material-icons/svg/svg/expand_more/baseline.svg?raw'; 8import expandMoreSVG from '@material-icons/svg/svg/expand_more/baseline.svg?raw';
9import infoSVG from '@material-icons/svg/svg/info/baseline.svg?raw'; 9import infoSVG from '@material-icons/svg/svg/info/baseline.svg?raw';
10import warningSVG from '@material-icons/svg/svg/warning/baseline.svg?raw'; 10import warningSVG from '@material-icons/svg/svg/warning/baseline.svg?raw';
11import { alpha, styled, type CSSObject } from '@mui/material/styles'; 11import {
12 alpha,
13 styled,
14 type CSSObject,
15 type Theme,
16} from '@mui/material/styles';
17import { range } from 'lodash-es';
12 18
13import svgURL from '../utils/svgURL'; 19import svgURL from '../utils/svgURL';
14 20
21function createTypeHashStyles(
22 theme: Theme,
23 colorIdentifiers: boolean,
24): CSSObject {
25 if (!colorIdentifiers) {
26 return {};
27 }
28 const result: CSSObject = {};
29 range(theme.palette.highlight.typeHash.length).forEach((i) => {
30 result[`.tok-problem-typeHash-${i}`] = {
31 '&, .tok-typeName': {
32 color: theme.palette.highlight.typeHash[i]?.text,
33 fontWeight: theme.typography.fontWeightEditorTypeHash,
34 },
35 };
36 });
37 return result;
38}
39
15export default styled('div', { 40export default styled('div', {
16 name: 'EditorTheme', 41 name: 'EditorTheme',
17 shouldForwardProp: (propName) => 42 shouldForwardProp: (propName) =>
@@ -19,7 +44,8 @@ export default styled('div', {
19})<{ 44})<{
20 showLineNumbers: boolean; 45 showLineNumbers: boolean;
21 showActiveLine: boolean; 46 showActiveLine: boolean;
22}>(({ theme, showLineNumbers, showActiveLine }) => { 47 colorIdentifiers: boolean;
48}>(({ theme, showLineNumbers, showActiveLine, colorIdentifiers }) => {
23 const editorFontStyle: CSSObject = { 49 const editorFontStyle: CSSObject = {
24 ...theme.typography.editor, 50 ...theme.typography.editor,
25 fontWeight: theme.typography.fontWeightEditorNormal, 51 fontWeight: theme.typography.fontWeightEditorNormal,
@@ -114,6 +140,11 @@ export default styled('div', {
114 }, 140 },
115 '.tok-problem-error': { 141 '.tok-problem-error': {
116 '&, & .tok-typeName': { 142 '&, & .tok-typeName': {
143 color: theme.palette.highlight.comment,
144 },
145 },
146 '.tok-invalid': {
147 '&, & .tok-typeName': {
117 color: theme.palette.error.main, 148 color: theme.palette.error.main,
118 }, 149 },
119 }, 150 },
@@ -124,6 +155,7 @@ export default styled('div', {
124 fontStyle: 'normal', 155 fontStyle: 'normal',
125 }, 156 },
126 }, 157 },
158 ...createTypeHashStyles(theme, colorIdentifiers),
127 }; 159 };
128 160
129 const matchingStyle: CSSObject = { 161 const matchingStyle: CSSObject = {