@red-hat-developer-hub/backstage-plugin-theme 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +139 -6
  3. package/config.d.ts +30 -0
  4. package/dist/backstage.esm.js +13 -0
  5. package/dist/backstage.esm.js.map +1 -0
  6. package/dist/darkTheme.esm.js +63 -0
  7. package/dist/darkTheme.esm.js.map +1 -0
  8. package/dist/hooks/useBranding.esm.js +17 -0
  9. package/dist/hooks/useBranding.esm.js.map +1 -0
  10. package/dist/hooks/useTheme.esm.js +15 -0
  11. package/dist/hooks/useTheme.esm.js.map +1 -0
  12. package/dist/hooks/useThemeConfig.esm.js +25 -0
  13. package/dist/hooks/useThemeConfig.esm.js.map +1 -0
  14. package/dist/hooks/useThemeOptions.esm.js +41 -0
  15. package/dist/hooks/useThemeOptions.esm.js.map +1 -0
  16. package/dist/index.d.ts +100 -9
  17. package/dist/index.esm.js +4 -1
  18. package/dist/index.esm.js.map +1 -1
  19. package/dist/lightTheme.esm.js +67 -0
  20. package/dist/lightTheme.esm.js.map +1 -0
  21. package/dist/rhdh.esm.js +25 -0
  22. package/dist/rhdh.esm.js.map +1 -0
  23. package/dist/themes.esm.js +109 -132
  24. package/dist/themes.esm.js.map +1 -1
  25. package/dist/typography.esm.js +75 -0
  26. package/dist/typography.esm.js.map +1 -0
  27. package/dist/utils/createComponents.esm.js +527 -0
  28. package/dist/utils/createComponents.esm.js.map +1 -0
  29. package/dist/utils/createPageTheme.esm.js +27 -0
  30. package/dist/utils/createPageTheme.esm.js.map +1 -0
  31. package/dist/utils/createPageThemes.esm.js +17 -0
  32. package/dist/utils/createPageThemes.esm.js.map +1 -0
  33. package/dist/utils/mergeTheme.esm.js +47 -0
  34. package/dist/utils/mergeTheme.esm.js.map +1 -0
  35. package/dist/utils/migrateTheme.esm.js +64 -0
  36. package/dist/utils/migrateTheme.esm.js.map +1 -0
  37. package/fonts/OPEN-FONT-LICENSE +94 -0
  38. package/fonts/README.md +9 -0
  39. package/fonts/RedHatDisplay/RedHatDisplay-Black.woff2 +0 -0
  40. package/fonts/RedHatDisplay/RedHatDisplay-BlackItalic.woff2 +0 -0
  41. package/fonts/RedHatDisplay/RedHatDisplay-Bold.woff2 +0 -0
  42. package/fonts/RedHatDisplay/RedHatDisplay-BoldItalic.woff2 +0 -0
  43. package/fonts/RedHatDisplay/RedHatDisplay-Italic.woff2 +0 -0
  44. package/fonts/RedHatDisplay/RedHatDisplay-Light.woff2 +0 -0
  45. package/fonts/RedHatDisplay/RedHatDisplay-LightItalic.woff2 +0 -0
  46. package/fonts/RedHatDisplay/RedHatDisplay-Medium.woff2 +0 -0
  47. package/fonts/RedHatDisplay/RedHatDisplay-MediumItalic.woff2 +0 -0
  48. package/fonts/RedHatDisplay/RedHatDisplay-Regular.woff2 +0 -0
  49. package/fonts/RedHatDisplay/RedHatDisplayVF-Italic.woff2 +0 -0
  50. package/fonts/RedHatDisplay/RedHatDisplayVF.woff2 +0 -0
  51. package/fonts/RedHatMono/RedHatMono-Bold.woff2 +0 -0
  52. package/fonts/RedHatMono/RedHatMono-BoldItalic.woff2 +0 -0
  53. package/fonts/RedHatMono/RedHatMono-Italic.woff2 +0 -0
  54. package/fonts/RedHatMono/RedHatMono-Light.woff2 +0 -0
  55. package/fonts/RedHatMono/RedHatMono-LightItalic.woff2 +0 -0
  56. package/fonts/RedHatMono/RedHatMono-Medium.woff2 +0 -0
  57. package/fonts/RedHatMono/RedHatMono-MediumItalic.woff2 +0 -0
  58. package/fonts/RedHatMono/RedHatMono-Regular.woff2 +0 -0
  59. package/fonts/RedHatMono/RedHatMonoVF-Italic.woff2 +0 -0
  60. package/fonts/RedHatMono/RedHatMonoVF.woff2 +0 -0
  61. package/fonts/RedHatText/RedHatText-Bold.woff2 +0 -0
  62. package/fonts/RedHatText/RedHatText-BoldItalic.woff2 +0 -0
  63. package/fonts/RedHatText/RedHatText-Italic.woff2 +0 -0
  64. package/fonts/RedHatText/RedHatText-Light.woff2 +0 -0
  65. package/fonts/RedHatText/RedHatText-LightItalic.woff2 +0 -0
  66. package/fonts/RedHatText/RedHatText-Medium.woff2 +0 -0
  67. package/fonts/RedHatText/RedHatText-MediumItalic.woff2 +0 -0
  68. package/fonts/RedHatText/RedHatText-Regular.woff2 +0 -0
  69. package/fonts/RedHatText/RedHatTextVF-Italic.woff2 +0 -0
  70. package/fonts/RedHatText/RedHatTextVF.woff2 +0 -0
  71. package/fonts/font.css +54 -0
  72. package/fonts/font.min.css +43 -0
  73. package/fonts/index.html +374 -0
  74. package/package.json +15 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @red-hat-developer-hub/backstage-plugin-theme
2
2
 
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 9d6e7b2: Align the 0.2.x theme with the latest 1.2.x RHDH theme. It's based on @redhat-developer/red-hat-developer-hub-theme@0.1.7 and the sourcecode is migrated from https://github.com/redhat-developer/red-hat-developer-hub-theme/tree/147ec09221a4440177e1bf89260c188041de7a79/src/themes/rhdh and aligned with linter and prettier rules in rhdh-plugins.
8
+
9
+ ## 0.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - bf40004: This version contains the initial theme from RHDH 1.2
14
+
3
15
  ## 0.1.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -1,12 +1,145 @@
1
- # @red-hat-developer-hub/backstage-plugin-theme
1
+ # [RHDH](https://developers.redhat.com/rhdh) / Red Hat Developer Hub Theme 🎨
2
2
 
3
- _This package was created through the Backstage CLI_.
3
+ A set of theming options for [MUI Material UI](https://mui.com/material-ui/) and
4
+ [Backstage](https://backstage.io/) that look more similar to [PatternFly](https://www.patternfly.org/).
4
5
 
5
- ## Installation
6
+ It also includes a [Storybook](https://storybook.js.org/) and
7
+ a [Storybook test-runner](https://github.com/storybookjs/test-runner) for automatic visual regression tests.
6
8
 
7
- Install the package via Yarn:
9
+ ## API
8
10
 
9
- ```sh
10
- cd <package-dir> # if within a monorepo
11
+ Returns all testable themes (incl. the backstage default color scheme and older RHDH versions):
12
+
13
+ - `getAllThemes: () => AppTheme[]`
14
+ - `useAllThemes: () => AppTheme[]`
15
+
16
+ Returns the latest, not released RHDH light and dark theme for your backstage/RHDH instance:
17
+
18
+ - `getThemes: () => AppTheme[]`
19
+ - `useThemes: () => AppTheme[]`
20
+ - `useLoaderTheme: () => MUIv5.Theme`
21
+
22
+ ## Install dependencies
23
+
24
+ ```shell
25
+ npm install @red-hat-developer-hub/backstage-plugin-theme
26
+ ```
27
+
28
+ or
29
+
30
+ ```shell
11
31
  yarn add @red-hat-developer-hub/backstage-plugin-theme
12
32
  ```
33
+
34
+ ## Use it with RHDH app
35
+
36
+ Starting with 1.2 this library is shipped with your RHDH installation.
37
+
38
+ On older RHDH instances you can install it:
39
+
40
+ 1. Install the dependency with
41
+
42
+ ```shell
43
+ yarn workspace app add @red-hat-developer-hub/backstage-plugin-theme
44
+ ```
45
+
46
+ 2. In `packages/app/src/components/DynamicRoot/DynamicRoot.tsx`
47
+
48
+ ```tsx
49
+ import { useThemes } from '@red-hat-developer-hub/backstage-plugin-theme';
50
+
51
+ // ...
52
+
53
+ const themes = useThemes();
54
+
55
+ // ...
56
+
57
+ app.current = createApp({
58
+ apis: [...staticApis, ...remoteApis],
59
+ // ... remove defaultThemes from here:
60
+ themes,
61
+ components: defaultAppComponents,
62
+ });
63
+ ```
64
+
65
+ ## Use it with any Backstage app
66
+
67
+ 1. Install the dependency with
68
+
69
+ ```shell
70
+ yarn workspace app add @red-hat-developer-hub/backstage-plugin-theme
71
+ ```
72
+
73
+ 2. Update `packages/app/src/App.tsx` and apply the themes to `createApp`:
74
+
75
+ ```tsx
76
+ import { getThemes } from '@red-hat-developer-hub/backstage-plugin-theme';
77
+
78
+ // ...
79
+
80
+ const app = createApp({
81
+ apis,
82
+ // ...
83
+ themes: getThemes(),
84
+ ```
85
+
86
+ ## Use it while developing a plugin
87
+
88
+ 1. Install the dependency with
89
+
90
+ ```shell
91
+ yarn workspace <plugin-root or plugin-name> add @red-hat-developer-hub/backstage-plugin-theme
92
+ ```
93
+
94
+ 2. Add to your `*/dev/index.tsx`:
95
+
96
+ ```tsx
97
+ import { getAllThemes } from '@red-hat-developer-hub/backstage-plugin-theme';
98
+
99
+ // ...
100
+
101
+ createDevApp()
102
+ .registerPlugin(...)
103
+ .addThemes(getAllThemes())
104
+ .addPage({
105
+ // ...
106
+ })
107
+ .render();
108
+ ```
109
+
110
+ ## Use `yarn link`
111
+
112
+ 1. Clone the rhdh theme and run `npm link` in it:
113
+
114
+ ```shell
115
+ cd red-hat-developer-hub-theme
116
+ yarn link
117
+ ```
118
+
119
+ 2. To use this link you can cd any other repository:
120
+
121
+ ```shell
122
+ cd ../backstage-plugins
123
+ yarn link @red-hat-developer-hub/backstage-plugin-theme
124
+ ```
125
+
126
+ ## Additional links
127
+
128
+ - Backstage
129
+ - [Getting started > App custom theme](https://backstage.io/docs/getting-started/app-custom-theme/)
130
+ - [packages/theme/src/unified](https://github.com/backstage/backstage/tree/master/packages/theme/src/unified)
131
+ - [packages/theme/src/unified/types.ts](https://github.com/backstage/backstage/blob/master/packages/theme/src/unified/types.ts)
132
+ - [packages/theme/src/v4/baseTheme.ts](https://github.com/backstage/backstage/blob/master/packages/theme/src/v4/baseTheme.ts)
133
+ - [packages/theme/src/unified/UnifiedTheme.tsx](https://github.com/backstage/backstage/blob/master/packages/theme/src/unified/UnifiedTheme.tsx)
134
+ - PatternFly
135
+ - [PatternFly design foundation](https://www.patternfly.org/design-foundations/colors)
136
+ - [PatternFly v6 design foundation](https://staging-v6.patternfly.org/design-foundations/colors)
137
+ - [Red Hat Brand standards/colors](https://www.redhat.com/en/about/brand/standards/color)
138
+ - MUI v4:
139
+ - [Theming](https://v4.mui.com/customization/theming/)
140
+ - [Palette](https://v4.mui.com/customization/palette/)
141
+ - MUI v5
142
+ - [Theming](https://mui.com/material-ui/customization/theming/)
143
+ - [Palette](https://mui.com/material-ui/customization/palette/)
144
+ - [Theme components](https://mui.com/material-ui/customization/theme-components/)
145
+ - [packages/mui-material/src/styles/adaptV4Theme.js](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/styles/adaptV4Theme.js)
package/config.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ /*
2
+ * Copyright 2024 The Backstage Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { ThemeConfig } from './src';
17
+
18
+ export interface Config {
19
+ app: {
20
+ branding?: {
21
+ /**
22
+ * Theme configuration.
23
+ * @deepVisibility frontend
24
+ */
25
+ theme?: {
26
+ [key: string]: ThemeConfig;
27
+ };
28
+ };
29
+ };
30
+ }
@@ -0,0 +1,13 @@
1
+ import { palettes } from '@backstage/theme';
2
+
3
+ const getDefaultThemeConfig = (mode) => {
4
+ const palette = mode === "dark" ? palettes.dark : palettes.light;
5
+ return {
6
+ variant: "backstage",
7
+ mode: mode === "dark" ? "dark" : "light",
8
+ palette
9
+ };
10
+ };
11
+
12
+ export { getDefaultThemeConfig };
13
+ //# sourceMappingURL=backstage.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backstage.esm.js","sources":["../src/backstage.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { palettes } from '@backstage/theme';\n\nimport { ThemeConfig } from './types';\n\nexport const getDefaultThemeConfig = (mode: 'light' | 'dark'): ThemeConfig => {\n const palette = mode === 'dark' ? palettes.dark : palettes.light;\n\n return {\n variant: 'backstage',\n mode: mode === 'dark' ? 'dark' : 'light',\n palette,\n };\n};\n"],"names":[],"mappings":";;AAmBa,MAAA,qBAAA,GAAwB,CAAC,IAAwC,KAAA;AAC5E,EAAA,MAAM,OAAU,GAAA,IAAA,KAAS,MAAS,GAAA,QAAA,CAAS,OAAO,QAAS,CAAA,KAAA;AAE3D,EAAO,OAAA;AAAA,IACL,OAAS,EAAA,WAAA;AAAA,IACT,IAAA,EAAM,IAAS,KAAA,MAAA,GAAS,MAAS,GAAA,OAAA;AAAA,IACjC;AAAA,GACF;AACF;;;;"}
@@ -0,0 +1,63 @@
1
+ import { palettes } from '@backstage/theme';
2
+
3
+ const customDarkTheme = () => {
4
+ const palette = palettes.dark;
5
+ return {
6
+ ...palette,
7
+ primary: {
8
+ main: "#1FA7F8"
9
+ },
10
+ secondary: {
11
+ main: "#B2A3FF"
12
+ },
13
+ navigation: {
14
+ background: "#0f1214",
15
+ indicator: "#0066CC",
16
+ color: "#ffffff",
17
+ selectedColor: "#ffffff",
18
+ navItem: {
19
+ hoverBackground: "#3c3f42"
20
+ },
21
+ submenu: {
22
+ background: "#0f1214"
23
+ }
24
+ },
25
+ rhdh: {
26
+ general: {
27
+ disabledBackground: "#444548",
28
+ disabled: "#AAABAC",
29
+ searchBarBorderColor: "#57585a",
30
+ formControlBackgroundColor: "#36373A",
31
+ mainSectionBackgroundColor: "#0f1214",
32
+ headerBottomBorderColor: "#A3A3A3",
33
+ cardBackgroundColor: "#292929",
34
+ sideBarBackgroundColor: "#1b1d21",
35
+ cardBorderColor: "#A3A3A3",
36
+ tableTitleColor: "#E0E0E0",
37
+ tableSubtitleColor: "#E0E0E0",
38
+ tableColumnTitleColor: "#E0E0E0",
39
+ tableRowHover: "#0f1214",
40
+ tableBorderColor: "#515151",
41
+ tableBackgroundColor: "#1b1d21",
42
+ tabsBottomBorderColor: "#444548",
43
+ contrastText: "#FFF"
44
+ },
45
+ primary: {
46
+ main: "#1FA7F8",
47
+ focusVisibleBorder: "#ADD6FF"
48
+ },
49
+ secondary: {
50
+ main: "#B2A3FF",
51
+ focusVisibleBorder: "#D0C7FF"
52
+ },
53
+ cards: {
54
+ headerTextColor: "#FFF",
55
+ headerBackgroundColor: "#0f1214",
56
+ headerBackgroundImage: "none"
57
+ }
58
+ }
59
+ };
60
+ };
61
+
62
+ export { customDarkTheme };
63
+ //# sourceMappingURL=darkTheme.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"darkTheme.esm.js","sources":["../src/darkTheme.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { palettes } from '@backstage/theme';\nimport { type PaletteOptions } from '@mui/material/styles';\nimport { type ThemeConfigPalette } from './types';\n\nexport const customDarkTheme = (): ThemeConfigPalette => {\n const palette: (typeof palettes)['dark'] & PaletteOptions = palettes.dark;\n return {\n ...palette,\n primary: {\n main: '#1FA7F8',\n },\n secondary: {\n main: '#B2A3FF',\n },\n navigation: {\n background: '#0f1214',\n indicator: '#0066CC',\n color: '#ffffff',\n selectedColor: '#ffffff',\n navItem: {\n hoverBackground: '#3c3f42',\n },\n submenu: {\n background: '#0f1214',\n },\n },\n rhdh: {\n general: {\n disabledBackground: '#444548',\n disabled: '#AAABAC',\n searchBarBorderColor: '#57585a',\n formControlBackgroundColor: '#36373A',\n mainSectionBackgroundColor: '#0f1214',\n headerBottomBorderColor: '#A3A3A3',\n cardBackgroundColor: '#292929',\n sideBarBackgroundColor: '#1b1d21',\n cardBorderColor: '#A3A3A3',\n tableTitleColor: '#E0E0E0',\n tableSubtitleColor: '#E0E0E0',\n tableColumnTitleColor: '#E0E0E0',\n tableRowHover: '#0f1214',\n tableBorderColor: '#515151',\n tableBackgroundColor: '#1b1d21',\n tabsBottomBorderColor: '#444548',\n contrastText: '#FFF',\n },\n primary: {\n main: '#1FA7F8',\n focusVisibleBorder: '#ADD6FF',\n },\n secondary: {\n main: '#B2A3FF',\n focusVisibleBorder: '#D0C7FF',\n },\n cards: {\n headerTextColor: '#FFF',\n headerBackgroundColor: '#0f1214',\n headerBackgroundImage: 'none',\n },\n },\n };\n};\n"],"names":[],"mappings":";;AAmBO,MAAM,kBAAkB,MAA0B;AACvD,EAAA,MAAM,UAAsD,QAAS,CAAA,IAAA;AACrE,EAAO,OAAA;AAAA,IACL,GAAG,OAAA;AAAA,IACH,OAAS,EAAA;AAAA,MACP,IAAM,EAAA;AAAA,KACR;AAAA,IACA,SAAW,EAAA;AAAA,MACT,IAAM,EAAA;AAAA,KACR;AAAA,IACA,UAAY,EAAA;AAAA,MACV,UAAY,EAAA,SAAA;AAAA,MACZ,SAAW,EAAA,SAAA;AAAA,MACX,KAAO,EAAA,SAAA;AAAA,MACP,aAAe,EAAA,SAAA;AAAA,MACf,OAAS,EAAA;AAAA,QACP,eAAiB,EAAA;AAAA,OACnB;AAAA,MACA,OAAS,EAAA;AAAA,QACP,UAAY,EAAA;AAAA;AACd,KACF;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,OAAS,EAAA;AAAA,QACP,kBAAoB,EAAA,SAAA;AAAA,QACpB,QAAU,EAAA,SAAA;AAAA,QACV,oBAAsB,EAAA,SAAA;AAAA,QACtB,0BAA4B,EAAA,SAAA;AAAA,QAC5B,0BAA4B,EAAA,SAAA;AAAA,QAC5B,uBAAyB,EAAA,SAAA;AAAA,QACzB,mBAAqB,EAAA,SAAA;AAAA,QACrB,sBAAwB,EAAA,SAAA;AAAA,QACxB,eAAiB,EAAA,SAAA;AAAA,QACjB,eAAiB,EAAA,SAAA;AAAA,QACjB,kBAAoB,EAAA,SAAA;AAAA,QACpB,qBAAuB,EAAA,SAAA;AAAA,QACvB,aAAe,EAAA,SAAA;AAAA,QACf,gBAAkB,EAAA,SAAA;AAAA,QAClB,oBAAsB,EAAA,SAAA;AAAA,QACtB,qBAAuB,EAAA,SAAA;AAAA,QACvB,YAAc,EAAA;AAAA,OAChB;AAAA,MACA,OAAS,EAAA;AAAA,QACP,IAAM,EAAA,SAAA;AAAA,QACN,kBAAoB,EAAA;AAAA,OACtB;AAAA,MACA,SAAW,EAAA;AAAA,QACT,IAAM,EAAA,SAAA;AAAA,QACN,kBAAoB,EAAA;AAAA,OACtB;AAAA,MACA,KAAO,EAAA;AAAA,QACL,eAAiB,EAAA,MAAA;AAAA,QACjB,qBAAuB,EAAA,SAAA;AAAA,QACvB,qBAAuB,EAAA;AAAA;AACzB;AACF,GACF;AACF;;;;"}
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { useApi, configApiRef } from '@backstage/core-plugin-api';
3
+
4
+ const useBranding = () => {
5
+ let configApi = void 0;
6
+ try {
7
+ configApi = useApi(configApiRef);
8
+ } catch (err) {
9
+ }
10
+ return React.useMemo(() => {
11
+ const branding = configApi?.getOptional("app.branding");
12
+ return branding;
13
+ }, [configApi]);
14
+ };
15
+
16
+ export { useBranding };
17
+ //# sourceMappingURL=useBranding.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBranding.esm.js","sources":["../../src/hooks/useBranding.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { ConfigApi, configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { Branding } from '../types';\n\nexport const useBranding = (): Branding | undefined => {\n let configApi: ConfigApi | undefined = undefined;\n try {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n configApi = useApi(configApiRef);\n } catch (err) {\n // useApi won't be initialized initially in createApp theme provider, and will get updated later\n }\n return React.useMemo(() => {\n const branding = configApi?.getOptional<Branding>('app.branding');\n return branding;\n }, [configApi]);\n};\n"],"names":[],"mappings":";;;AAmBO,MAAM,cAAc,MAA4B;AACrD,EAAA,IAAI,SAAmC,GAAA,KAAA,CAAA;AACvC,EAAI,IAAA;AAEF,IAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AAAA,WACxB,GAAK,EAAA;AAAA;AAGd,EAAO,OAAA,KAAA,CAAM,QAAQ,MAAM;AACzB,IAAM,MAAA,QAAA,GAAW,SAAW,EAAA,WAAA,CAAsB,cAAc,CAAA;AAChE,IAAO,OAAA,QAAA;AAAA,GACT,EAAG,CAAC,SAAS,CAAC,CAAA;AAChB;;;;"}
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { createUnifiedTheme } from '@backstage/theme';
3
+ import { useThemeOptions } from './useThemeOptions.esm.js';
4
+
5
+ const useTheme = (themeConfig) => {
6
+ const unifiedThemeOptions = useThemeOptions(themeConfig);
7
+ const theme = React.useMemo(
8
+ () => createUnifiedTheme(unifiedThemeOptions),
9
+ [unifiedThemeOptions]
10
+ );
11
+ return theme;
12
+ };
13
+
14
+ export { useTheme };
15
+ //# sourceMappingURL=useTheme.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTheme.esm.js","sources":["../../src/hooks/useTheme.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { createUnifiedTheme, type UnifiedTheme } from '@backstage/theme';\nimport type { ThemeConfig } from '../types';\nimport { useThemeOptions } from './useThemeOptions';\n\n/** Creates a memorized Backstage UnifiedTheme based on the given ThemeConfig. */\nexport const useTheme = (themeConfig: ThemeConfig): UnifiedTheme => {\n const unifiedThemeOptions = useThemeOptions(themeConfig);\n const theme = React.useMemo<UnifiedTheme>(\n () => createUnifiedTheme(unifiedThemeOptions),\n [unifiedThemeOptions],\n );\n return theme;\n};\n"],"names":[],"mappings":";;;;AAqBa,MAAA,QAAA,GAAW,CAAC,WAA2C,KAAA;AAClE,EAAM,MAAA,mBAAA,GAAsB,gBAAgB,WAAW,CAAA;AACvD,EAAA,MAAM,QAAQ,KAAM,CAAA,OAAA;AAAA,IAClB,MAAM,mBAAmB,mBAAmB,CAAA;AAAA,IAC5C,CAAC,mBAAmB;AAAA,GACtB;AACA,EAAO,OAAA,KAAA;AACT;;;;"}
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { useApi, configApiRef } from '@backstage/core-plugin-api';
3
+
4
+ const useThemeConfig = (themeName) => {
5
+ let configApi = void 0;
6
+ try {
7
+ configApi = useApi(configApiRef);
8
+ } catch (err) {
9
+ }
10
+ return React.useMemo(() => {
11
+ if (!configApi) {
12
+ return {
13
+ mode: themeName.includes("dark") ? "dark" : "light"
14
+ };
15
+ }
16
+ const themeConfig = configApi.getOptional(`app.branding.theme.${themeName}`) ?? {};
17
+ if (!themeConfig.mode) {
18
+ themeConfig.mode = themeName.includes("dark") ? "dark" : "light";
19
+ }
20
+ return themeConfig;
21
+ }, [themeName, configApi]);
22
+ };
23
+
24
+ export { useThemeConfig };
25
+ //# sourceMappingURL=useThemeConfig.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useThemeConfig.esm.js","sources":["../../src/hooks/useThemeConfig.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { ConfigApi, configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { ThemeConfig } from '../types';\n\nexport const useThemeConfig = (themeName: string): ThemeConfig => {\n let configApi: ConfigApi | undefined = undefined;\n try {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n configApi = useApi<ConfigApi>(configApiRef); // NOSONAR\n } catch (err) {\n // useApi won't be initialized initially in createApp theme provider, and will get updated later\n }\n return React.useMemo(() => {\n if (!configApi) {\n return {\n mode: themeName.includes('dark') ? 'dark' : 'light',\n };\n }\n const themeConfig =\n configApi.getOptional<ThemeConfig>(`app.branding.theme.${themeName}`) ??\n {};\n if (!themeConfig.mode) {\n themeConfig.mode = themeName.includes('dark') ? 'dark' : 'light';\n }\n return themeConfig;\n }, [themeName, configApi]);\n};\n"],"names":[],"mappings":";;;AAmBa,MAAA,cAAA,GAAiB,CAAC,SAAmC,KAAA;AAChE,EAAA,IAAI,SAAmC,GAAA,KAAA,CAAA;AACvC,EAAI,IAAA;AAEF,IAAA,SAAA,GAAY,OAAkB,YAAY,CAAA;AAAA,WACnC,GAAK,EAAA;AAAA;AAGd,EAAO,OAAA,KAAA,CAAM,QAAQ,MAAM;AACzB,IAAA,IAAI,CAAC,SAAW,EAAA;AACd,MAAO,OAAA;AAAA,QACL,IAAM,EAAA,SAAA,CAAU,QAAS,CAAA,MAAM,IAAI,MAAS,GAAA;AAAA,OAC9C;AAAA;AAEF,IAAA,MAAM,cACJ,SAAU,CAAA,WAAA,CAAyB,sBAAsB,SAAS,CAAA,CAAE,KACpE,EAAC;AACH,IAAI,IAAA,CAAC,YAAY,IAAM,EAAA;AACrB,MAAA,WAAA,CAAY,IAAO,GAAA,SAAA,CAAU,QAAS,CAAA,MAAM,IAAI,MAAS,GAAA,OAAA;AAAA;AAE3D,IAAO,OAAA,WAAA;AAAA,GACN,EAAA,CAAC,SAAW,EAAA,SAAS,CAAC,CAAA;AAC3B;;;;"}
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import { getDefaultThemeConfig } from '../backstage.esm.js';
3
+ import { getDefaultThemeConfig as getDefaultThemeConfig$1 } from '../rhdh.esm.js';
4
+ import { migrateThemeConfig } from '../utils/migrateTheme.esm.js';
5
+ import { mergeUnifiedThemeOptions } from '../utils/mergeTheme.esm.js';
6
+ import { createPageThemes } from '../utils/createPageThemes.esm.js';
7
+ import { createComponents } from '../utils/createComponents.esm.js';
8
+
9
+ const useThemeOptions = (themeConfig) => {
10
+ const theme = React.useMemo(() => {
11
+ const mode = themeConfig.mode ?? "light";
12
+ const variant = themeConfig.variant ?? "rhdh";
13
+ let defaultThemeConfig;
14
+ if (variant === "backstage") {
15
+ defaultThemeConfig = getDefaultThemeConfig(mode);
16
+ } else {
17
+ defaultThemeConfig = getDefaultThemeConfig$1(mode);
18
+ }
19
+ const migratedThemeConfig = migrateThemeConfig(themeConfig);
20
+ const mergedThemeConfig = mergeUnifiedThemeOptions(
21
+ defaultThemeConfig,
22
+ migratedThemeConfig
23
+ );
24
+ const unifiedThemeOption = {
25
+ palette: mergedThemeConfig.palette,
26
+ defaultPageTheme: mergedThemeConfig.defaultPageTheme,
27
+ fontFamily: mergedThemeConfig.fontFamily,
28
+ htmlFontSize: mergedThemeConfig.htmlFontSize,
29
+ typography: mergedThemeConfig.typography
30
+ };
31
+ unifiedThemeOption.pageTheme = createPageThemes(mergedThemeConfig);
32
+ if (variant !== "backstage") {
33
+ unifiedThemeOption.components = createComponents(mergedThemeConfig);
34
+ }
35
+ return unifiedThemeOption;
36
+ }, [themeConfig]);
37
+ return theme;
38
+ };
39
+
40
+ export { useThemeOptions };
41
+ //# sourceMappingURL=useThemeOptions.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useThemeOptions.esm.js","sources":["../../src/hooks/useThemeOptions.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { type UnifiedThemeOptions } from '@backstage/theme';\nimport type { ThemeConfig } from '../types';\nimport * as backstage from '../backstage';\nimport * as rhdh from '../rhdh';\nimport { migrateThemeConfig } from '../utils/migrateTheme';\nimport { mergeUnifiedThemeOptions } from '../utils/mergeTheme';\nimport { createPageThemes } from '../utils/createPageThemes';\nimport { createComponents } from '../utils/createComponents';\n\n/** Creates a memorized Backstage UnifiedThemeOptions based on the given ThemeConfig. */\nexport const useThemeOptions = (\n themeConfig: ThemeConfig,\n): UnifiedThemeOptions => {\n const theme = React.useMemo<UnifiedThemeOptions>(() => {\n const mode = themeConfig.mode ?? 'light';\n const variant = themeConfig.variant ?? 'rhdh';\n\n let defaultThemeConfig: ThemeConfig;\n if (variant === 'backstage') {\n defaultThemeConfig = backstage.getDefaultThemeConfig(mode);\n } else {\n defaultThemeConfig = rhdh.getDefaultThemeConfig(mode);\n }\n\n const migratedThemeConfig = migrateThemeConfig(themeConfig);\n const mergedThemeConfig = mergeUnifiedThemeOptions(\n defaultThemeConfig,\n migratedThemeConfig,\n );\n\n const unifiedThemeOption: UnifiedThemeOptions = {\n palette: mergedThemeConfig.palette as UnifiedThemeOptions['palette'],\n defaultPageTheme: mergedThemeConfig.defaultPageTheme,\n fontFamily: mergedThemeConfig.fontFamily,\n htmlFontSize: mergedThemeConfig.htmlFontSize,\n typography: mergedThemeConfig.typography,\n };\n\n unifiedThemeOption.pageTheme = createPageThemes(mergedThemeConfig);\n\n if (variant !== 'backstage') {\n unifiedThemeOption.components = createComponents(mergedThemeConfig);\n }\n\n return unifiedThemeOption;\n }, [themeConfig]);\n return theme;\n};\n"],"names":["backstage.getDefaultThemeConfig","rhdh.getDefaultThemeConfig"],"mappings":";;;;;;;;AA0Ba,MAAA,eAAA,GAAkB,CAC7B,WACwB,KAAA;AACxB,EAAM,MAAA,KAAA,GAAQ,KAAM,CAAA,OAAA,CAA6B,MAAM;AACrD,IAAM,MAAA,IAAA,GAAO,YAAY,IAAQ,IAAA,OAAA;AACjC,IAAM,MAAA,OAAA,GAAU,YAAY,OAAW,IAAA,MAAA;AAEvC,IAAI,IAAA,kBAAA;AACJ,IAAA,IAAI,YAAY,WAAa,EAAA;AAC3B,MAAqB,kBAAA,GAAAA,sBAAgC,IAAI,CAAA;AAAA,KACpD,MAAA;AACL,MAAqB,kBAAA,GAAAC,wBAA2B,IAAI,CAAA;AAAA;AAGtD,IAAM,MAAA,mBAAA,GAAsB,mBAAmB,WAAW,CAAA;AAC1D,IAAA,MAAM,iBAAoB,GAAA,wBAAA;AAAA,MACxB,kBAAA;AAAA,MACA;AAAA,KACF;AAEA,IAAA,MAAM,kBAA0C,GAAA;AAAA,MAC9C,SAAS,iBAAkB,CAAA,OAAA;AAAA,MAC3B,kBAAkB,iBAAkB,CAAA,gBAAA;AAAA,MACpC,YAAY,iBAAkB,CAAA,UAAA;AAAA,MAC9B,cAAc,iBAAkB,CAAA,YAAA;AAAA,MAChC,YAAY,iBAAkB,CAAA;AAAA,KAChC;AAEA,IAAmB,kBAAA,CAAA,SAAA,GAAY,iBAAiB,iBAAiB,CAAA;AAEjE,IAAA,IAAI,YAAY,WAAa,EAAA;AAC3B,MAAmB,kBAAA,CAAA,UAAA,GAAa,iBAAiB,iBAAiB,CAAA;AAAA;AAGpE,IAAO,OAAA,kBAAA;AAAA,GACT,EAAG,CAAC,WAAW,CAAC,CAAA;AAChB,EAAO,OAAA,KAAA;AACT;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,12 +1,103 @@
1
+ import { UnifiedThemeOptions } from '@backstage/theme';
2
+ import * as _mui_material_styles from '@mui/material/styles';
1
3
  import { AppTheme } from '@backstage/core-plugin-api';
2
4
 
3
- /**
4
- * @public
5
- */
6
- declare const themes: AppTheme[];
7
- /**
8
- * @public
9
- */
10
- declare const allThemes: AppTheme[];
5
+ type BackstageThemePalette = UnifiedThemeOptions['palette'];
6
+ interface RHDHThemePalette {
7
+ general: {
8
+ disabledBackground: string;
9
+ disabled: string;
10
+ searchBarBorderColor: string;
11
+ formControlBackgroundColor: string;
12
+ mainSectionBackgroundColor: string;
13
+ headerBottomBorderColor: string;
14
+ cardBackgroundColor: string;
15
+ sideBarBackgroundColor: string;
16
+ cardBorderColor: string;
17
+ tableTitleColor: string;
18
+ tableSubtitleColor: string;
19
+ tableColumnTitleColor: string;
20
+ tableRowHover: string;
21
+ tableBorderColor: string;
22
+ tableBackgroundColor: string;
23
+ tabsBottomBorderColor: string;
24
+ contrastText: string;
25
+ };
26
+ primary: {
27
+ main: string;
28
+ focusVisibleBorder: string;
29
+ };
30
+ secondary: {
31
+ main: string;
32
+ focusVisibleBorder: string;
33
+ };
34
+ cards?: {
35
+ headerTextColor: string;
36
+ headerBackgroundColor: string;
37
+ headerBackgroundImage: string;
38
+ };
39
+ }
40
+ type ThemeConfigPalette = BackstageThemePalette & {
41
+ rhdh?: RHDHThemePalette;
42
+ };
43
+ interface ThemeConfigPageTheme {
44
+ backgroundColor?: string | string[];
45
+ colors?: string | string[];
46
+ shape?: string;
47
+ backgroundImage?: string;
48
+ fontColor?: string;
49
+ }
50
+ interface ThemeConfigOptions {
51
+ components?: 'rhdh' | 'backstage' | 'mui';
52
+ rippleEffect?: 'on' | 'off';
53
+ paper?: 'patternfly' | 'mui';
54
+ buttons?: 'patternfly' | 'mui';
55
+ inputs?: 'patternfly' | 'mui';
56
+ accordions?: 'patternfly' | 'mui';
57
+ sidebars?: 'patternfly' | 'mui';
58
+ pages?: 'patternfly' | 'mui';
59
+ headers?: 'patternfly' | 'mui';
60
+ toolbars?: 'patternfly' | 'mui';
61
+ dialogs?: 'patternfly' | 'mui';
62
+ cards?: 'patternfly' | 'mui';
63
+ tables?: 'patternfly' | 'mui';
64
+ tabs?: 'patternfly' | 'mui';
65
+ }
66
+ interface ThemeConfig {
67
+ /** Optional key to load different defaults. Fallbacks to the latest `rhdh` theme if not defined. */
68
+ variant?: 'rhdh' | 'backstage';
69
+ /** Light or dark theme. Automatically selects `dark` if the theme name contains the keyword "dark". */
70
+ mode?: 'light' | 'dark';
71
+ palette?: ThemeConfigPalette;
72
+ fontFamily?: UnifiedThemeOptions['fontFamily'];
73
+ htmlFontSize?: UnifiedThemeOptions['htmlFontSize'];
74
+ typography?: UnifiedThemeOptions['typography'];
75
+ defaultPageTheme?: string;
76
+ pageTheme?: Record<string, ThemeConfigPageTheme>;
77
+ options?: ThemeConfigOptions;
78
+ }
79
+ interface Branding {
80
+ theme?: {
81
+ [key: string]: ThemeConfig;
82
+ };
83
+ }
84
+ interface Config {
85
+ app: {
86
+ branding?: Branding;
87
+ };
88
+ }
11
89
 
12
- export { allThemes, themes };
90
+ declare const useBranding: () => Branding | undefined;
91
+
92
+ declare const useThemeConfig: (themeName: string) => ThemeConfig;
93
+
94
+ /** Creates a memorized Backstage UnifiedThemeOptions based on the given ThemeConfig. */
95
+ declare const useThemeOptions: (themeConfig: ThemeConfig) => UnifiedThemeOptions;
96
+
97
+ declare const getAllThemes: () => AppTheme[];
98
+ declare const useAllThemes: () => AppTheme[];
99
+ declare const getThemes: () => AppTheme[];
100
+ declare const useThemes: () => AppTheme[];
101
+ declare const useLoaderTheme: () => _mui_material_styles.Theme;
102
+
103
+ export { type BackstageThemePalette, type Branding, type Config, type RHDHThemePalette, type ThemeConfig, type ThemeConfigOptions, type ThemeConfigPageTheme, type ThemeConfigPalette, getAllThemes, getThemes, useAllThemes, useBranding, useLoaderTheme, useThemeConfig, useThemeOptions, useThemes };
package/dist/index.esm.js CHANGED
@@ -1,2 +1,5 @@
1
- export { allThemes, themes } from './themes.esm.js';
1
+ export { useBranding } from './hooks/useBranding.esm.js';
2
+ export { useThemeConfig } from './hooks/useThemeConfig.esm.js';
3
+ export { useThemeOptions } from './hooks/useThemeOptions.esm.js';
4
+ export { getAllThemes, getThemes, useAllThemes, useLoaderTheme, useThemes } from './themes.esm.js';
2
5
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -0,0 +1,67 @@
1
+ import { palettes } from '@backstage/theme';
2
+
3
+ const customLightTheme = () => {
4
+ const palette = palettes.light;
5
+ return {
6
+ ...palette,
7
+ primary: {
8
+ main: "#0066CC"
9
+ },
10
+ secondary: {
11
+ main: "#8476D1"
12
+ },
13
+ navigation: {
14
+ background: "#222427",
15
+ indicator: "#0066CC",
16
+ color: "#ffffff",
17
+ selectedColor: "#ffffff",
18
+ navItem: {
19
+ hoverBackground: "#3c3f42"
20
+ },
21
+ submenu: {
22
+ background: "#222427"
23
+ }
24
+ },
25
+ text: {
26
+ primary: "#151515",
27
+ secondary: "#757575"
28
+ },
29
+ rhdh: {
30
+ general: {
31
+ disabledBackground: "#D2D2D2",
32
+ disabled: "#6A6E73",
33
+ searchBarBorderColor: "#E4E4E4",
34
+ formControlBackgroundColor: "#FFF",
35
+ mainSectionBackgroundColor: "#FFF",
36
+ headerBottomBorderColor: "#C7C7C7",
37
+ cardBackgroundColor: "#FFF",
38
+ sideBarBackgroundColor: "#212427",
39
+ cardBorderColor: "#C7C7C7",
40
+ tableTitleColor: "#181818",
41
+ tableSubtitleColor: "#616161",
42
+ tableColumnTitleColor: "#151515",
43
+ tableRowHover: "#F5F5F5",
44
+ tableBorderColor: "#E0E0E0",
45
+ tableBackgroundColor: "#FFF",
46
+ tabsBottomBorderColor: "#D2D2D2",
47
+ contrastText: "#FFF"
48
+ },
49
+ primary: {
50
+ main: "#0066CC",
51
+ focusVisibleBorder: "#0066CC"
52
+ },
53
+ secondary: {
54
+ main: "#8476D1",
55
+ focusVisibleBorder: "#8476D1"
56
+ },
57
+ cards: {
58
+ headerTextColor: "#151515",
59
+ headerBackgroundColor: "#FFF",
60
+ headerBackgroundImage: "none"
61
+ }
62
+ }
63
+ };
64
+ };
65
+
66
+ export { customLightTheme };
67
+ //# sourceMappingURL=lightTheme.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lightTheme.esm.js","sources":["../src/lightTheme.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { palettes } from '@backstage/theme';\nimport { type PaletteOptions } from '@mui/material/styles';\n\nimport { type ThemeConfigPalette } from './types';\n\nexport const customLightTheme = (): ThemeConfigPalette => {\n const palette: (typeof palettes)['light'] & PaletteOptions = palettes.light;\n return {\n ...palette,\n primary: {\n main: '#0066CC',\n },\n secondary: {\n main: '#8476D1',\n },\n navigation: {\n background: '#222427',\n indicator: '#0066CC',\n color: '#ffffff',\n selectedColor: '#ffffff',\n navItem: {\n hoverBackground: '#3c3f42',\n },\n submenu: {\n background: '#222427',\n },\n },\n text: {\n primary: '#151515',\n secondary: '#757575',\n },\n rhdh: {\n general: {\n disabledBackground: '#D2D2D2',\n disabled: '#6A6E73',\n searchBarBorderColor: '#E4E4E4',\n formControlBackgroundColor: '#FFF',\n mainSectionBackgroundColor: '#FFF',\n headerBottomBorderColor: '#C7C7C7',\n cardBackgroundColor: '#FFF',\n sideBarBackgroundColor: '#212427',\n cardBorderColor: '#C7C7C7',\n tableTitleColor: '#181818',\n tableSubtitleColor: '#616161',\n tableColumnTitleColor: '#151515',\n tableRowHover: '#F5F5F5',\n tableBorderColor: '#E0E0E0',\n tableBackgroundColor: '#FFF',\n tabsBottomBorderColor: '#D2D2D2',\n contrastText: '#FFF',\n },\n primary: {\n main: '#0066CC',\n focusVisibleBorder: '#0066CC',\n },\n secondary: {\n main: '#8476D1',\n focusVisibleBorder: '#8476D1',\n },\n cards: {\n headerTextColor: '#151515',\n headerBackgroundColor: '#FFF',\n headerBackgroundImage: 'none',\n },\n },\n };\n};\n"],"names":[],"mappings":";;AAoBO,MAAM,mBAAmB,MAA0B;AACxD,EAAA,MAAM,UAAuD,QAAS,CAAA,KAAA;AACtE,EAAO,OAAA;AAAA,IACL,GAAG,OAAA;AAAA,IACH,OAAS,EAAA;AAAA,MACP,IAAM,EAAA;AAAA,KACR;AAAA,IACA,SAAW,EAAA;AAAA,MACT,IAAM,EAAA;AAAA,KACR;AAAA,IACA,UAAY,EAAA;AAAA,MACV,UAAY,EAAA,SAAA;AAAA,MACZ,SAAW,EAAA,SAAA;AAAA,MACX,KAAO,EAAA,SAAA;AAAA,MACP,aAAe,EAAA,SAAA;AAAA,MACf,OAAS,EAAA;AAAA,QACP,eAAiB,EAAA;AAAA,OACnB;AAAA,MACA,OAAS,EAAA;AAAA,QACP,UAAY,EAAA;AAAA;AACd,KACF;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,OAAS,EAAA,SAAA;AAAA,MACT,SAAW,EAAA;AAAA,KACb;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,OAAS,EAAA;AAAA,QACP,kBAAoB,EAAA,SAAA;AAAA,QACpB,QAAU,EAAA,SAAA;AAAA,QACV,oBAAsB,EAAA,SAAA;AAAA,QACtB,0BAA4B,EAAA,MAAA;AAAA,QAC5B,0BAA4B,EAAA,MAAA;AAAA,QAC5B,uBAAyB,EAAA,SAAA;AAAA,QACzB,mBAAqB,EAAA,MAAA;AAAA,QACrB,sBAAwB,EAAA,SAAA;AAAA,QACxB,eAAiB,EAAA,SAAA;AAAA,QACjB,eAAiB,EAAA,SAAA;AAAA,QACjB,kBAAoB,EAAA,SAAA;AAAA,QACpB,qBAAuB,EAAA,SAAA;AAAA,QACvB,aAAe,EAAA,SAAA;AAAA,QACf,gBAAkB,EAAA,SAAA;AAAA,QAClB,oBAAsB,EAAA,MAAA;AAAA,QACtB,qBAAuB,EAAA,SAAA;AAAA,QACvB,YAAc,EAAA;AAAA,OAChB;AAAA,MACA,OAAS,EAAA;AAAA,QACP,IAAM,EAAA,SAAA;AAAA,QACN,kBAAoB,EAAA;AAAA,OACtB;AAAA,MACA,SAAW,EAAA;AAAA,QACT,IAAM,EAAA,SAAA;AAAA,QACN,kBAAoB,EAAA;AAAA,OACtB;AAAA,MACA,KAAO,EAAA;AAAA,QACL,eAAiB,EAAA,SAAA;AAAA,QACjB,qBAAuB,EAAA,MAAA;AAAA,QACvB,qBAAuB,EAAA;AAAA;AACzB;AACF,GACF;AACF;;;;"}
@@ -0,0 +1,25 @@
1
+ import { customDarkTheme } from './darkTheme.esm.js';
2
+ import { customLightTheme } from './lightTheme.esm.js';
3
+ import { fonts, typography } from './typography.esm.js';
4
+
5
+ const getDefaultThemeConfig = (mode) => {
6
+ const palette = mode === "dark" ? customDarkTheme() : customLightTheme();
7
+ return {
8
+ variant: "rhdh",
9
+ mode: mode === "dark" ? "dark" : "light",
10
+ palette,
11
+ fontFamily: fonts.text,
12
+ typography,
13
+ defaultPageTheme: "default",
14
+ pageTheme: {
15
+ default: {
16
+ backgroundColor: mode === "dark" ? "#0f1214" : "#ffffff",
17
+ fontColor: mode === "dark" ? "#ffffff" : "#000000"
18
+ }
19
+ },
20
+ options: {}
21
+ };
22
+ };
23
+
24
+ export { getDefaultThemeConfig };
25
+ //# sourceMappingURL=rhdh.esm.js.map