-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from christoph-jerolimov/replay-theme
feat(theme): migrate and release rhdh-theme 0.0.1 (RHDH 1.0)
- Loading branch information
Showing
9 changed files
with
200 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@red-hat-developer-hub/backstage-plugin-theme': patch | ||
--- | ||
|
||
This version contains the initial theme from RHDH 1.0 https://github.com/janus-idp/backstage-showcase/tree/v1.0.0/packages/app/src/themes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2024 The Backstage Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { UnifiedThemeOptions } from '@backstage/theme'; | ||
|
||
const redhatFont = `@font-face { | ||
font-family: 'Red Hat Font'; | ||
font-style: normal; | ||
font-display: swap; | ||
font-weight: 400; | ||
src: url(/fonts/RedHatText-Regular.woff2) format('woff2'), | ||
url(/fonts/RedHatText-Regular.otf) format('opentype'), | ||
url(/fonts/RedHatText-Regular.ttf) format('truetype'); | ||
}`; | ||
|
||
export const components: UnifiedThemeOptions['components'] = { | ||
MuiCssBaseline: { | ||
styleOverrides: redhatFont, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright 2024 The Backstage Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { createUnifiedTheme, themes } from '@backstage/theme'; | ||
import { components } from './componentOverrides'; | ||
import { pageTheme } from './pageTheme'; | ||
import { ThemeColors } from './types'; | ||
|
||
export const customDarkTheme = (themeColors: ThemeColors) => | ||
createUnifiedTheme({ | ||
palette: { | ||
...themes.dark.getTheme('v5')?.palette, | ||
...(themeColors.primaryColor && { | ||
primary: { | ||
...themes.light.getTheme('v5')?.palette.primary, | ||
main: themeColors.primaryColor, | ||
}, | ||
}), | ||
navigation: { | ||
background: '#0f1214', | ||
indicator: themeColors.navigationIndicatorColor || '#009596', | ||
color: '#ffffff', | ||
selectedColor: '#ffffff', | ||
navItem: { | ||
hoverBackground: '#030303', | ||
}, | ||
}, | ||
}, | ||
defaultPageTheme: 'home', | ||
pageTheme: pageTheme(themeColors), | ||
components, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright 2024 The Backstage Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { createUnifiedTheme, themes } from '@backstage/theme'; | ||
import { components } from './componentOverrides'; | ||
import { pageTheme } from './pageTheme'; | ||
import { ThemeColors } from './types'; | ||
|
||
export const customLightTheme = (themeColors: ThemeColors) => | ||
createUnifiedTheme({ | ||
palette: { | ||
...themes.light.getTheme('v5')?.palette, | ||
...(themeColors.primaryColor && { | ||
primary: { | ||
...themes.light.getTheme('v5')?.palette.primary, | ||
main: themeColors.primaryColor, | ||
}, | ||
}), | ||
navigation: { | ||
background: '#222427', | ||
indicator: themeColors.navigationIndicatorColor || '#009596', | ||
color: '#ffffff', | ||
selectedColor: '#ffffff', | ||
navItem: { | ||
hoverBackground: '#4f5255', | ||
}, | ||
}, | ||
}, | ||
defaultPageTheme: 'home', | ||
pageTheme: pageTheme(themeColors), | ||
components, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright 2024 The Backstage Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { PageTheme, genPageTheme, shapes } from '@backstage/theme'; | ||
import { ThemeColors } from './types'; | ||
|
||
export const pageTheme = (input: ThemeColors): Record<string, PageTheme> => { | ||
const { headerColor1, headerColor2 } = input; | ||
const defaultColors = ['#005f60', '#73c5c5']; | ||
const headerColor = [ | ||
headerColor1 || defaultColors[0], | ||
headerColor2 || defaultColors[1], | ||
]; | ||
return { | ||
home: genPageTheme({ | ||
colors: [headerColor[0], headerColor[1]], | ||
shape: shapes.wave, | ||
}), | ||
app: genPageTheme({ | ||
colors: [headerColor[0], headerColor[1]], | ||
shape: shapes.wave, | ||
}), | ||
apis: genPageTheme({ | ||
colors: [headerColor[0], headerColor[1]], | ||
shape: shapes.wave, | ||
}), | ||
documentation: genPageTheme({ | ||
colors: [headerColor[0], headerColor[1]], | ||
shape: shapes.wave, | ||
}), | ||
tool: genPageTheme({ | ||
colors: [headerColor[0], headerColor[1]], | ||
shape: shapes.round, | ||
}), | ||
other: genPageTheme({ | ||
colors: [headerColor[0], headerColor[1]], | ||
shape: shapes.wave, | ||
}), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright 2024 The Backstage Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
export type ThemeColors = { | ||
primaryColor?: string | undefined; | ||
headerColor1?: string | undefined; | ||
headerColor2?: string | undefined; | ||
navigationIndicatorColor?: string | undefined; | ||
}; |