diff options
Diffstat (limited to 'subprojects/frontend/src/graph/GraphTheme.tsx')
-rw-r--r-- | subprojects/frontend/src/graph/GraphTheme.tsx | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/subprojects/frontend/src/graph/GraphTheme.tsx b/subprojects/frontend/src/graph/GraphTheme.tsx index 14d58b96..60fd7925 100644 --- a/subprojects/frontend/src/graph/GraphTheme.tsx +++ b/subprojects/frontend/src/graph/GraphTheme.tsx | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/> | 2 | * SPDX-FileCopyrightText: 2023-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 | */ |
@@ -7,7 +7,13 @@ | |||
7 | import cancelSVG from '@material-icons/svg/svg/cancel/baseline.svg?raw'; | 7 | import cancelSVG from '@material-icons/svg/svg/cancel/baseline.svg?raw'; |
8 | import labelSVG from '@material-icons/svg/svg/label/baseline.svg?raw'; | 8 | import labelSVG from '@material-icons/svg/svg/label/baseline.svg?raw'; |
9 | import labelOutlinedSVG from '@material-icons/svg/svg/label/outline.svg?raw'; | 9 | import labelOutlinedSVG from '@material-icons/svg/svg/label/outline.svg?raw'; |
10 | import { alpha, styled, type CSSObject } from '@mui/material/styles'; | 10 | import { |
11 | alpha, | ||
12 | styled, | ||
13 | type CSSObject, | ||
14 | type Theme, | ||
15 | } from '@mui/material/styles'; | ||
16 | import { range } from 'lodash-es'; | ||
11 | 17 | ||
12 | import svgURL from '../utils/svgURL'; | 18 | import svgURL from '../utils/svgURL'; |
13 | 19 | ||
@@ -31,6 +37,18 @@ function createEdgeColor( | |||
31 | }; | 37 | }; |
32 | } | 38 | } |
33 | 39 | ||
40 | function createTypeHashStyles(theme: Theme): CSSObject { | ||
41 | const result: CSSObject = {}; | ||
42 | range(theme.palette.highlight.typeHash.length).forEach((i) => { | ||
43 | result[`.node-typeHash-${i}`] = { | ||
44 | '& [fill="green"]': { | ||
45 | fill: theme.palette.highlight.typeHash[i]?.box, | ||
46 | }, | ||
47 | }; | ||
48 | }); | ||
49 | return result; | ||
50 | } | ||
51 | |||
34 | export default styled('div', { | 52 | export default styled('div', { |
35 | name: 'GraphTheme', | 53 | name: 'GraphTheme', |
36 | })(({ theme }) => ({ | 54 | })(({ theme }) => ({ |
@@ -68,6 +86,7 @@ export default styled('div', { | |||
68 | '.node-exists-UNKNOWN [stroke="black"]': { | 86 | '.node-exists-UNKNOWN [stroke="black"]': { |
69 | strokeDasharray: '5 2', | 87 | strokeDasharray: '5 2', |
70 | }, | 88 | }, |
89 | ...createTypeHashStyles(theme), | ||
71 | '.edge': { | 90 | '.edge': { |
72 | '& text': { | 91 | '& text': { |
73 | fontFamily: theme.typography.fontFamily, | 92 | fontFamily: theme.typography.fontFamily, |