@red-hat-developer-hub/backstage-plugin-theme 0.2.2 → 0.3.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @red-hat-developer-hub/backstage-plugin-theme
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - cecd842: Align the 0.3.x theme with the 1.3.x RHDH theme. It's based on @redhat-developer/red-hat-developer-hub-theme@0.3.0 and the sourcecode is migrated from https://github.com/redhat-developer/red-hat-developer-hub-theme/tree/1cd29db2abb807f94a2edb09688157b316bf6ff8/src/themes/rhdh and aligned with linter and prettier rules in rhdh-plugins.
8
+
3
9
  ## 0.2.2
4
10
 
5
11
  ### Patch Changes
@@ -30,7 +30,7 @@ const customDarkTheme = () => {
30
30
  formControlBackgroundColor: "#36373A",
31
31
  mainSectionBackgroundColor: "#0f1214",
32
32
  headerBottomBorderColor: "#A3A3A3",
33
- cardBackgroundColor: "#292929",
33
+ cardBackgroundColor: "#1b1d21",
34
34
  sideBarBackgroundColor: "#1b1d21",
35
35
  cardBorderColor: "#A3A3A3",
36
36
  tableTitleColor: "#E0E0E0",
@@ -1 +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;;;;"}
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: '#1b1d21',\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,I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B;AACF,GACF;AACF;;;;"}
@@ -17,6 +17,9 @@ const useThemeConfig = (themeName) => {
17
17
  if (!themeConfig.mode) {
18
18
  themeConfig.mode = themeName.includes("dark") ? "dark" : "light";
19
19
  }
20
+ if (Array.isArray(themeConfig?.pageTheme?.default.fontColor)) {
21
+ themeConfig.pageTheme.default.fontColor = themeConfig.pageTheme.default.fontColor[0];
22
+ }
20
23
  return themeConfig;
21
24
  }, [themeName, configApi]);
22
25
  };
@@ -1 +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;;;;"}
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\n if (Array.isArray(themeConfig?.pageTheme?.default.fontColor)) {\n themeConfig.pageTheme.default.fontColor =\n themeConfig.pageTheme.default.fontColor[0];\n }\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;AAG3D,IAAA,IAAI,MAAM,OAAQ,CAAA,WAAA,EAAa,SAAW,EAAA,OAAA,CAAQ,SAAS,CAAG,EAAA;AAC5D,MAAA,WAAA,CAAY,UAAU,OAAQ,CAAA,SAAA,GAC5B,YAAY,SAAU,CAAA,OAAA,CAAQ,UAAU,CAAC,CAAA;AAAA;AAG7C,IAAO,OAAA,WAAA;AAAA,GACN,EAAA,CAAC,SAAW,EAAA,SAAS,CAAC,CAAA;AAC3B;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@red-hat-developer-hub/backstage-plugin-theme",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "main": "dist/index.esm.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "Apache-2.0",