|
|
|
@ -117,7 +117,7 @@ export abstract class BigValueLayout { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getPanelStyles(): CSSProperties { |
|
|
|
|
const { width, height, theme, colorMode, hasGradient } = this.props; |
|
|
|
|
const { width, height, theme, colorMode } = this.props; |
|
|
|
|
|
|
|
|
|
const panelStyles: CSSProperties = { |
|
|
|
|
width: `${width}px`, |
|
|
|
@ -130,23 +130,17 @@ export abstract class BigValueLayout { |
|
|
|
|
|
|
|
|
|
const themeFactor = theme.isDark ? 1 : -0.7; |
|
|
|
|
|
|
|
|
|
function buildGradientBackground(valueColor: BigValueLayout['valueColor']) { |
|
|
|
|
const bgColor2 = tinycolor(valueColor) |
|
|
|
|
.darken(15 * themeFactor) |
|
|
|
|
.spin(8) |
|
|
|
|
.toRgbString(); |
|
|
|
|
const bgColor3 = tinycolor(valueColor) |
|
|
|
|
.darken(5 * themeFactor) |
|
|
|
|
.spin(-8) |
|
|
|
|
.toRgbString(); |
|
|
|
|
|
|
|
|
|
return `linear-gradient(120deg, ${bgColor2}, ${bgColor3})`; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch (colorMode) { |
|
|
|
|
case BigValueColorMode.Background: |
|
|
|
|
panelStyles.background = |
|
|
|
|
hasGradient === false ? `none ${this.valueColor}` : buildGradientBackground(this.valueColor); |
|
|
|
|
const bgColor2 = tinycolor(this.valueColor) |
|
|
|
|
.darken(15 * themeFactor) |
|
|
|
|
.spin(8) |
|
|
|
|
.toRgbString(); |
|
|
|
|
const bgColor3 = tinycolor(this.valueColor) |
|
|
|
|
.darken(5 * themeFactor) |
|
|
|
|
.spin(-8) |
|
|
|
|
.toRgbString(); |
|
|
|
|
panelStyles.background = `linear-gradient(120deg, ${bgColor2}, ${bgColor3})`; |
|
|
|
|
break; |
|
|
|
|
case BigValueColorMode.Value: |
|
|
|
|
panelStyles.background = `transparent`; |
|
|
|
|