Stat: improve color mode migration from singlestat panels (#35538) (#35587)

(cherry picked from commit 056e17216e)

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2021-06-11 18:29:41 +02:00
committed by GitHub
co-authored by Ryan McKinley
parent b4e30f1bd3
commit be3032c4e8
6 changed files with 63 additions and 14 deletions
@@ -10,6 +10,7 @@ import { FormattedValueDisplay } from '../FormattedValueDisplay/FormattedValueDi
export enum BigValueColorMode {
Value = 'value',
Background = 'background',
None = 'none',
}
export enum BigValueGraphMode {
@@ -90,6 +90,10 @@ export abstract class BigValueLayout {
break;
case BigValueColorMode.Background:
styles.color = getTextColorForBackground(this.valueColor);
break;
case BigValueColorMode.None:
styles.color = this.props.theme.colors.text.primary;
break;
}
return styles;
@@ -159,13 +163,16 @@ export abstract class BigValueLayout {
let lineColor: string;
switch (colorMode) {
case BigValueColorMode.Value:
lineColor = this.valueColor;
fillColor = tinycolor(this.valueColor).setAlpha(0.2).toRgbString();
break;
case BigValueColorMode.Background:
fillColor = 'rgba(255,255,255,0.4)';
lineColor = tinycolor(this.valueColor).brighten(40).toRgbString();
break;
case BigValueColorMode.None:
case BigValueColorMode.Value:
default:
lineColor = this.valueColor;
fillColor = tinycolor(this.valueColor).setAlpha(0.2).toRgbString();
break;
}
// The graph field configuration applied to Y values