= props => {
percent={asPercentage}
strokeWidth={12}
trailWidth={12}
- strokeColor={getProgressColor(asActual, inverse, max)}
+ strokeColor={getProgressColor(theme.palette, asActual, inverse, max)}
className={classes.circle}
/>
diff --git a/packages/theme/src/BackstageTheme.ts b/packages/theme/src/BackstageTheme.ts
index 202bdbc08c..f264e01861 100644
--- a/packages/theme/src/BackstageTheme.ts
+++ b/packages/theme/src/BackstageTheme.ts
@@ -20,7 +20,7 @@ import { blue, yellow } from '@material-ui/core/colors';
import { BackstageMuiTheme, BackstageMuiThemeOptions } from './types';
-export const COLORS = {
+const COLORS = {
PAGE_BACKGROUND: '#F8F8F8',
DEFAULT_PAGE_THEME_COLOR: '#7C3699',
DEFAULT_PAGE_THEME_LIGHT_COLOR: '#ECDBF2',
diff --git a/packages/theme/src/BackstageThemeDark.ts b/packages/theme/src/BackstageThemeDark.ts
index b8b89c8f0a..1f02b893ac 100644
--- a/packages/theme/src/BackstageThemeDark.ts
+++ b/packages/theme/src/BackstageThemeDark.ts
@@ -20,7 +20,7 @@ import { blue, yellow } from '@material-ui/core/colors';
import { BackstageMuiTheme, BackstageMuiThemeOptions } from './types';
-export const COLORS = {
+const COLORS = {
PAGE_BACKGROUND: '#282828',
EFAULT_PAGE_THEME_COLOR: '#232323',
DEFAULT_PAGE_THEME_COLOR: '#7C3699',
diff --git a/packages/theme/src/BackstageThemeLight.ts b/packages/theme/src/BackstageThemeLight.ts
index 14bc942910..f238132f50 100644
--- a/packages/theme/src/BackstageThemeLight.ts
+++ b/packages/theme/src/BackstageThemeLight.ts
@@ -20,7 +20,7 @@ import { blue, yellow } from '@material-ui/core/colors';
import { BackstageMuiTheme, BackstageMuiThemeOptions } from './types';
-export const COLORS = {
+const COLORS = {
PAGE_BACKGROUND: '#F8F8F8',
DEFAULT_PAGE_THEME_COLOR: '#7C3699',
DEFAULT_PAGE_THEME_LIGHT_COLOR: '#ECDBF2',
diff --git a/packages/theme/src/index.ts b/packages/theme/src/index.ts
index 136355dc37..8aa7e30ef5 100644
--- a/packages/theme/src/index.ts
+++ b/packages/theme/src/index.ts
@@ -15,4 +15,4 @@
*/
export { default as BackstageThemeLight } from './BackstageThemeLight';
export { default as BackstageThemeDark } from './BackstageThemeDark';
-export { default as BackstageTheme, COLORS } from './BackstageTheme';
+export { default as BackstageTheme } from './BackstageTheme';
diff --git a/plugins/lighthouse/src/components/CategoryTrendline/index.tsx b/plugins/lighthouse/src/components/CategoryTrendline/index.tsx
index 95622ed918..a46aff52e5 100644
--- a/plugins/lighthouse/src/components/CategoryTrendline/index.tsx
+++ b/plugins/lighthouse/src/components/CategoryTrendline/index.tsx
@@ -15,22 +15,28 @@
*/
import React, { FC } from 'react';
import { Sparklines, SparklinesLine, SparklinesProps } from 'react-sparklines';
-import { COLORS } from '@backstage/theme';
+import { useTheme } from '@material-ui/core';
+import { BackstageTheme } from '@backstage/theme';
-function color(data: number[]): string | undefined {
+function color(
+ data: number[],
+ theme: typeof BackstageTheme,
+): string | undefined {
const lastNum = data[data.length - 1];
if (!lastNum) return undefined;
- if (lastNum >= 0.9) return COLORS.STATUS.OK;
- if (lastNum >= 0.5) return COLORS.STATUS.WARNING;
- return COLORS.STATUS.ERROR;
+ if (lastNum >= 0.9) return theme.palette.status.ok;
+ if (lastNum >= 0.5) return theme.palette.status.warning;
+ return theme.palette.status.error;
}
const CategoryTrendline: FC = props => {
+ const theme = useTheme();
+
if (!props.data) return null;
return (
{props.title && {props.title}}
-
+
);
};