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) { function interfaceToColor(name) {
// Try to load color map from style // Try to load color map from style
print("checking color for name", name)
if (Style.interfaceColors[name]) { if (Style.interfaceColors[name]) {
print("have color for name", name, Style.interfaceColors[name])
return Style.interfaceColors[name]; return Style.interfaceColors[name];
} }
if (styleBase.interfaceColors[name]) { if (styleBase.interfaceColors[name]) {
print("have color for name", name, styleBase.interfaceColors[name])
return 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 // Icon/graph colors for various interfaces
property var interfaceColors: { property var interfaceColors: {
"temperaturesensor": "red", "temperaturesensor": red,
"humiditysensor": "deepskyblue", "humiditysensor": blue,
"moisturesensor":"blue", "moisturesensor": lightBlue,
"lightsensor": "orange", "lightsensor": yellow,
"conductivitysensor": "green", "conductivitysensor": green,
"pressuresensor": "grey", "pressuresensor": gray,
"noisesensor": "darkviolet", "noisesensor": purple,
"cosensor": "darkgray", "cosensor": darkGray,
"co2sensor": "turquoise", "co2sensor": turquoise,
"gassensor": "yellow", "gassensor": orange,
"daylightsensor": "gold", "daylightsensor": yellow,
"presencesensor": "darkblue", "presencesensor": darkBlue,
"closablesensor": "green", "closablesensor": green,
"smartmeterconsumer": "orange", "smartmeterconsumer": orange,
"smartmeterproducer": "lightgreen", "smartmeterproducer": lime,
"energymeter": "deepskyblue", "energymeter": darkBlue,
"heating" : "crimson", "heating" : red,
"cooling": "dodgerBlue", "cooling": lightBlue,
"thermostat": "dodgerblue", "thermostat": blue,
"irrigation": "lightblue", "irrigation": blue,
"windspeedsensor": "blue", "windspeedsensor": blue,
"ventilation": "lightblue", "ventilation": lightBlue,
"watersensor": "aqua", "watersensor": lightBlue,
"waterlevelsensor": "aqua", "waterlevelsensor": lightBlue,
"phsensor": "green", "phsensor": green,
"o2sensor": "lightblue", "o2sensor": lightBlue,
"orpsensor": "yellow", "orpsensor": yellow,
"powersocket": "aquamarine", "powersocket": lime,
"evcharger": "limegreen", "evcharger": lime,
"energystorage": "limegreen" "energystorage": lime
} }
property var stateColors: { property var stateColors: {
"totalEnergyConsumed": "orange", "totalEnergyConsumed": red,
"totalEnergyProduced": "lightgreen", "totalEnergyProduced": yellow,
"currentPower": "deepskyblue", "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 fastAnimationDuration: 100
readonly property int animationDuration: 150 readonly property int animationDuration: 150
readonly property int slowAnimationDuration: 300 readonly property int slowAnimationDuration: 300

View File

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

View File

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

View File

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

View File

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

View File

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