diff options
Diffstat (limited to 'subprojects/frontend/src/editor/EditorTheme.ts')
-rw-r--r-- | subprojects/frontend/src/editor/EditorTheme.ts | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/subprojects/frontend/src/editor/EditorTheme.ts b/subprojects/frontend/src/editor/EditorTheme.ts index 9f560dfb..383e1b75 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,29 @@ import cancelSVG from '@material-icons/svg/svg/cancel/baseline.svg?raw'; | |||
8 | import expandMoreSVG from '@material-icons/svg/svg/expand_more/baseline.svg?raw'; | 8 | import expandMoreSVG from '@material-icons/svg/svg/expand_more/baseline.svg?raw'; |
9 | import infoSVG from '@material-icons/svg/svg/info/baseline.svg?raw'; | 9 | import infoSVG from '@material-icons/svg/svg/info/baseline.svg?raw'; |
10 | import warningSVG from '@material-icons/svg/svg/warning/baseline.svg?raw'; | 10 | import warningSVG from '@material-icons/svg/svg/warning/baseline.svg?raw'; |
11 | import { alpha, styled, type CSSObject } from '@mui/material/styles'; | 11 | import { |
12 | alpha, | ||
13 | styled, | ||
14 | type CSSObject, | ||
15 | type Theme, | ||
16 | } from '@mui/material/styles'; | ||
17 | import { range } from 'lodash-es'; | ||
12 | 18 | ||
13 | import svgURL from '../utils/svgURL'; | 19 | import svgURL from '../utils/svgURL'; |
14 | 20 | ||
21 | function createTypeHashStyles(theme: Theme): CSSObject { | ||
22 | const result: CSSObject = {}; | ||
23 | range(theme.palette.highlight.typeHash.length).forEach((i) => { | ||
24 | result[`.tok-problem-typeHash-${i}`] = { | ||
25 | '&, .tok-typeName': { | ||
26 | color: theme.palette.highlight.typeHash[i]?.text, | ||
27 | fontWeight: theme.typography.fontWeightEditorTypeHash, | ||
28 | }, | ||
29 | }; | ||
30 | }); | ||
31 | return result; | ||
32 | } | ||
33 | |||
15 | export default styled('div', { | 34 | export default styled('div', { |
16 | name: 'EditorTheme', | 35 | name: 'EditorTheme', |
17 | shouldForwardProp: (propName) => | 36 | shouldForwardProp: (propName) => |
@@ -124,6 +143,7 @@ export default styled('div', { | |||
124 | fontStyle: 'normal', | 143 | fontStyle: 'normal', |
125 | }, | 144 | }, |
126 | }, | 145 | }, |
146 | ...createTypeHashStyles(theme), | ||
127 | }; | 147 | }; |
128 | 148 | ||
129 | const matchingStyle: CSSObject = { | 149 | const matchingStyle: CSSObject = { |