1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-16 21:05:30 +03:00

The PID slider heatmap now works with the dark theme

This commit is contained in:
Andrew Young 2019-12-24 01:53:31 +00:00
parent cefd7a6e8d
commit 4c3ac659b5
2 changed files with 11 additions and 10 deletions

View file

@ -2134,7 +2134,7 @@ TABS.pid_tuning.updateFilterWarning = function() {
TABS.pid_tuning.updatePIDColors = function(clear = false) { TABS.pid_tuning.updatePIDColors = function(clear = false) {
const setTuningElementColor = function(element, mspValue, currentValue) { const setTuningElementColor = function(element, mspValue, currentValue) {
if (clear) { if (clear) {
element.css({ "background-color": "white" }); element.css({ "background-color": "transparent" });
return; return;
} }

View file

@ -8,15 +8,15 @@ const CSSUtil = function () {};
CSSUtil.prototype.colorTables = { CSSUtil.prototype.colorTables = {
redWhiteGreen: [ redWhiteGreen: [
{ percentage: -1, color: { r: 0xff, g: 0x00, b: 0x00 } }, { percentage: -1, color: { r: 0xff, g: 0x00, b: 0x00, a: 1.0 } },
{ percentage: 0, color: { r: 0xff, g: 0xff, b: 0xff } }, { percentage: 0, color: { r: 0xff, g: 0xff, b: 0xff, a: 1.0 } },
{ percentage: 1, color: { r: 0x00, g: 0xff, b: 0x00 } } { percentage: 1, color: { r: 0x00, g: 0xff, b: 0x00, a: 1.0 } }
], ],
pidSlider: [ pidSlider: [
{ percentage: -1, color: { r: 0xc5, g: 0xc5, b: 0xc5 } }, { percentage: -1, color: { r: 0xc5, g: 0xc5, b: 0xc5, a: 1.0 } },
{ percentage: 0, color: { r: 0xff, g: 0xff, b: 0xff } }, { percentage: 0, color: { r: 0xff, g: 0xff, b: 0xff, a: 0.0 } },
{ percentage: 1, color: { r: 0xff, g: 0x54, b: 0x0e } } { percentage: 1, color: { r: 0xff, g: 0x54, b: 0x0e, a: 1.0 } }
], ]
}; };
// Stack Overflow: https://stackoverflow.com/a/7128796/4107016 // Stack Overflow: https://stackoverflow.com/a/7128796/4107016
@ -40,9 +40,10 @@ CSSUtil.prototype.getColorForPercentage = function(percentage, colorTable = null
const color = { const color = {
r: Math.floor(lower.color.r * percentageLower + upper.color.r * percentageUpper), r: Math.floor(lower.color.r * percentageLower + upper.color.r * percentageUpper),
g: Math.floor(lower.color.g * percentageLower + upper.color.g * percentageUpper), g: Math.floor(lower.color.g * percentageLower + upper.color.g * percentageUpper),
b: Math.floor(lower.color.b * percentageLower + upper.color.b * percentageUpper) b: Math.floor(lower.color.b * percentageLower + upper.color.b * percentageUpper),
a: lower.color.a * percentageLower + upper.color.a * percentageUpper
}; };
return "rgb(" + [color.r, color.g, color.b].join(",") + ")"; return "rgba(" + [color.r, color.g, color.b, color.a].join(",") + ")";
}; };
const cssUtil = new CSSUtil(); const cssUtil = new CSSUtil();