diff --git a/.changeset/silly-dolphins-repair.md b/.changeset/silly-dolphins-repair.md
new file mode 100644
index 0000000000..43c6aed230
--- /dev/null
+++ b/.changeset/silly-dolphins-repair.md
@@ -0,0 +1,5 @@
+---
+'@backstage/core': patch
+---
+
+Added the color prop to TrendLine from the Sparklines props types to be able to have custom colors.
diff --git a/packages/core/src/components/TrendLine/TrendLine.stories.tsx b/packages/core/src/components/TrendLine/TrendLine.stories.tsx
index 5d2972095a..6a5f8564f7 100644
--- a/packages/core/src/components/TrendLine/TrendLine.stories.tsx
+++ b/packages/core/src/components/TrendLine/TrendLine.stories.tsx
@@ -55,6 +55,37 @@ const data = [
month: ,
year: ,
},
+ {
+ stock: 'E',
+ day: (
+
+ ),
+ week: (
+
+ ),
+ month: (
+
+ ),
+ year: (
+
+ ),
+ },
];
const columns = [
@@ -98,3 +129,13 @@ export const TrendingDown = () => (
);
+
+export const TrendingCustomColor = () => (
+
+
+
+);
diff --git a/packages/core/src/components/TrendLine/TrendLine.tsx b/packages/core/src/components/TrendLine/TrendLine.tsx
index 43b76e8c32..84024634d3 100644
--- a/packages/core/src/components/TrendLine/TrendLine.tsx
+++ b/packages/core/src/components/TrendLine/TrendLine.tsx
@@ -15,7 +15,12 @@
*/
import React from 'react';
-import { Sparklines, SparklinesLine, SparklinesProps } from 'react-sparklines';
+import {
+ Sparklines,
+ SparklinesLine,
+ SparklinesLineProps,
+ SparklinesProps,
+} from 'react-sparklines';
import { useTheme } from '@material-ui/core';
import { BackstageTheme } from '@backstage/theme';
@@ -27,14 +32,17 @@ function color(data: number[], theme: BackstageTheme): string | undefined {
return theme.palette.status.error;
}
-export const TrendLine = (props: SparklinesProps & { title?: string }) => {
+export const TrendLine = (
+ props: SparklinesProps &
+ Pick & { title?: string },
+) => {
const theme = useTheme();
if (!props.data) return null;
return (
{props.title && {props.title}}
-
+
);
};