Fix color scheme to only use the new palette colors

This commit is contained in:
Michael Zanetti 2022-05-06 18:53:44 +02:00
parent d3c84de3b0
commit 56a3d3db0d
7 changed files with 84 additions and 64 deletions

View File

@ -450,11 +450,14 @@ ApplicationWindow {
function interfaceToColor(name) {
// Try to load color map from style
print("checking color for name", name)
if (Style.interfaceColors[name]) {
print("have color for name", name, Style.interfaceColors[name])
return Style.interfaceColors[name];
}
if (styleBase.interfaceColors[name]) {
print("have color for name", name, styleBase.interfaceColors[name])
return styleBase.interfaceColors[name];
}

View File

@ -66,59 +66,67 @@ Item {
})
// Color definitions
property color white: "white"
property color gray: "gray"
property color darkGray: "darkgray"
property color lightGray: "lightGray"
property color red: "indianred"
property color yellow: "#cdcd5c"
property color green: "#5ccd5c"
property color lightBlue: "#5ccdcd"
property color darkBlue: "#5c5ccd"
property color pink: "#cd5ccd"
property color orange: "#cd955c"
property color lime: "#95cd5c"
property color turquoise: "#5ccd95"
property color blue: "#5c95cd"
property color purple: "#955ccd"
property color rose: "#cd5c95"
// Icon/graph colors for various interfaces
property var interfaceColors: {
"temperaturesensor": "red",
"humiditysensor": "deepskyblue",
"moisturesensor":"blue",
"lightsensor": "orange",
"conductivitysensor": "green",
"pressuresensor": "grey",
"noisesensor": "darkviolet",
"cosensor": "darkgray",
"co2sensor": "turquoise",
"gassensor": "yellow",
"daylightsensor": "gold",
"presencesensor": "darkblue",
"closablesensor": "green",
"smartmeterconsumer": "orange",
"smartmeterproducer": "lightgreen",
"energymeter": "deepskyblue",
"heating" : "crimson",
"cooling": "dodgerBlue",
"thermostat": "dodgerblue",
"irrigation": "lightblue",
"windspeedsensor": "blue",
"ventilation": "lightblue",
"watersensor": "aqua",
"waterlevelsensor": "aqua",
"phsensor": "green",
"o2sensor": "lightblue",
"orpsensor": "yellow",
"powersocket": "aquamarine",
"evcharger": "limegreen",
"energystorage": "limegreen"
"temperaturesensor": red,
"humiditysensor": blue,
"moisturesensor": lightBlue,
"lightsensor": yellow,
"conductivitysensor": green,
"pressuresensor": gray,
"noisesensor": purple,
"cosensor": darkGray,
"co2sensor": turquoise,
"gassensor": orange,
"daylightsensor": yellow,
"presencesensor": darkBlue,
"closablesensor": green,
"smartmeterconsumer": orange,
"smartmeterproducer": lime,
"energymeter": darkBlue,
"heating" : red,
"cooling": lightBlue,
"thermostat": blue,
"irrigation": blue,
"windspeedsensor": blue,
"ventilation": lightBlue,
"watersensor": lightBlue,
"waterlevelsensor": lightBlue,
"phsensor": green,
"o2sensor": lightBlue,
"orpsensor": yellow,
"powersocket": lime,
"evcharger": lime,
"energystorage": lime
}
property var stateColors: {
"totalEnergyConsumed": "orange",
"totalEnergyProduced": "lightgreen",
"currentPower": "deepskyblue",
"totalEnergyConsumed": red,
"totalEnergyProduced": yellow,
"currentPower": blue,
}
property color red: "indianred"
property color green: "#5ccd5c"
property color yellow: "gold"
property color white: "white"
property color gray: "gray"
property color darkGray: "darkGray"
property color blue: "#5c5ccd"
property color darkBlue: "royalblue"
property color orange: "#cd955c"
property color purple: "#6d5fd5"
property color lime: "#99ca53"
property color pink: "orchid"
// Animations
readonly property int fastAnimationDuration: 100
readonly property int animationDuration: 150
readonly property int slowAnimationDuration: 300

View File

@ -67,9 +67,9 @@ Page {
color: {
switch (model.level) {
case AppLogController.LogLevelCritical:
return "red";
return Style.red;
case AppLogController.LogLevelWarning:
return "orange";
return Style.orange;
case AppLogController.LogLevelInfo:
return Style.foregroundColor;
case AppLogController.LogLevelDebug:

View File

@ -29,7 +29,7 @@ ColorIcon {
}
color: connectedState && connectedState.value === false
? "red"
? Style.red
: signalStrengthState && signalStrengthState.value < 20
? "orange" : Style.iconColor
? Style.orange : Style.iconColor
}

View File

@ -49,14 +49,15 @@ Item {
case "on":
return Style.accentColor
case "green":
return "#73c0b3";
return Style.green;
case "off":
return "lightgray";
return Style.lightGray;
case "orange":
return "#fedf6f";
return Style.orange;
case "red":
return "#dd7777"
return Style.red
}
return "transparent"
}
border.width: 1
border.color: Style.foregroundColor

View File

@ -110,7 +110,7 @@ ThingsListPageBase {
color: {
switch (model.interfaceName) {
case "closablesensor":
return sensorValueDelegate.stateValue && sensorValueDelegate.stateValue.value === true ? "green" : "red";
return sensorValueDelegate.stateValue && sensorValueDelegate.stateValue.value === true ? Style.green : Style.red;
default:
return app.interfaceToColor(model.interfaceName)
}

View File

@ -92,11 +92,19 @@ StatsBase {
// print("balance changed:", d.consumptionSet, powerBalanceLogs, powerBalanceLogs.count)
// print("updating", start ? start.timestamp : "", start ? start.totalConsumption : 0, root.energyManager.totalConsumption, root.energyManager.totalConsumption - (start ? start.totalConsumption : 0))
if (root.hasProducers) {
d.consumptionSet.replace(d.consumptionSet.count - 1, root.energyManager.totalConsumption - (start ? start.totalConsumption : 0))
d.productionSet.replace(d.productionSet.count - 1, root.energyManager.totalProduction - (start ? start.totalProduction : 0))
var consumption = root.energyManager.totalConsumption - (start ? start.totalConsumption : 0)
d.consumptionSet.replace(d.consumptionSet.count - 1, consumption)
valueAxis.adjustMax(consumption)
var production = root.energyManager.totalProduction - (start ? start.totalProduction : 0)
d.productionSet.replace(d.productionSet.count - 1, production)
valueAxis.adjustMax(production)
}
d.acquisitionSet.replace(d.acquisitionSet.count - 1, root.energyManager.totalAcquisition - (start ? start.totalAcquisition : 0))
d.returnSet.replace(d.returnSet.count - 1, root.energyManager.totalReturn - (start ? start.totalReturn : 0))
var acquisition = root.energyManager.totalAcquisition - (start ? start.totalAcquisition : 0)
d.acquisitionSet.replace(d.acquisitionSet.count - 1, acquisition)
valueAxis.adjustMax(acquisition)
var ret = root.energyManager.totalReturn - (start ? start.totalReturn : 0)
d.returnSet.replace(d.returnSet.count - 1, ret)
valueAxis.adjustMax(ret)
}
}
@ -268,11 +276,11 @@ StatsBase {
print("********** resetting chart")
if (root.hasProducers) {
d.consumptionSet = barSeries.append(qsTr("Consumed"), [])
d.consumptionSet.color = Style.blue
d.consumptionSet.color = Style.darkBlue
d.consumptionSet.borderColor = d.consumptionSet.color
d.consumptionSet.borderWidth = 0
d.productionSet = barSeries.append(qsTr("Produced"), [])
d.productionSet.color = Style.green
d.productionSet.color = Style.yellow
d.productionSet.borderColor = d.productionSet.color
d.productionSet.borderWidth = 0
}
@ -281,7 +289,7 @@ StatsBase {
d.acquisitionSet.borderColor = d.acquisitionSet.color
d.acquisitionSet.borderWidth = 0
d.returnSet = barSeries.append(qsTr("To grid"), [])
d.returnSet.color = Style.orange
d.returnSet.color = Style.green
d.returnSet.borderColor = d.returnSet.color
d.returnSet.borderWidth = 0
}
@ -429,7 +437,7 @@ StatsBase {
Rectangle {
width: Style.extraSmallFont.pixelSize
height: width
color: Style.blue
color: Style.darkBlue
}
Label {
text: d.consumptionSet ? qsTr("Consumed: %1 kWh").arg(d.consumptionSet.at(toolTip.idx).toFixed(2)) : ""
@ -441,7 +449,7 @@ StatsBase {
Rectangle {
width: Style.extraSmallFont.pixelSize
height: width
color: Style.green
color: Style.yellow
}
Label {
text: d.productionSet ? qsTr("Produced: %1 kWh").arg(d.productionSet.at(toolTip.idx).toFixed(2)) : ""
@ -463,7 +471,7 @@ StatsBase {
Rectangle {
width: Style.extraSmallFont.pixelSize
height: width
color: Style.orange
color: Style.green
}
Label {
text: d.returnSet ? qsTr("To grid: %1 kWh").arg(d.returnSet.at(toolTip.idx).toFixed(2)) : ""