Merge pull request #7732 from tragiclifestories/gauge-color

Allow overriding colour in Gauge components
This commit is contained in:
Patrik Oldsberg
2021-11-10 19:07:41 +01:00
committed by GitHub
10 changed files with 162 additions and 43 deletions
+23
View File
@@ -0,0 +1,23 @@
---
'@backstage/core-components': patch
---
Add new way to override color selection to progress bar/gauge components.
`Gauge`, `LinearGauge` and `GaugeCard` all accept a `getColor` prop,
which is a function of the type:
```ts
export type GaugePropsGetColor = (args: {
palette: Palette;
value: number;
inverse?: boolean;
max?: number;
}) => string;
```
Return a standard CSS color string (e.g. "red", "#f02020"), and the gauge will
be set to that color.
If the prop is omitted, the default implementation is unchanged from previous
versions.