From 56a3d3db0dd08063f04c845d6b15d9c0248da7a7 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 6 May 2022 18:53:44 +0200 Subject: [PATCH] Fix color scheme to only use the new palette colors --- nymea-app/ui/Nymea.qml | 3 + nymea-app/ui/StyleBase.qml | 98 ++++++++++--------- nymea-app/ui/appsettings/AppLogPage.qml | 4 +- .../ui/components/ConnectionStatusIcon.qml | 4 +- nymea-app/ui/components/Led.qml | 9 +- .../devicelistpages/SensorsDeviceListPage.qml | 2 +- .../ui/mainviews/energy/PowerBalanceStats.qml | 28 ++++-- 7 files changed, 84 insertions(+), 64 deletions(-) diff --git a/nymea-app/ui/Nymea.qml b/nymea-app/ui/Nymea.qml index 9e7b4fa9..01cb1805 100644 --- a/nymea-app/ui/Nymea.qml +++ b/nymea-app/ui/Nymea.qml @@ -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]; } diff --git a/nymea-app/ui/StyleBase.qml b/nymea-app/ui/StyleBase.qml index 889ae495..fb4c9271 100644 --- a/nymea-app/ui/StyleBase.qml +++ b/nymea-app/ui/StyleBase.qml @@ -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 diff --git a/nymea-app/ui/appsettings/AppLogPage.qml b/nymea-app/ui/appsettings/AppLogPage.qml index 81b7b766..9da17b37 100644 --- a/nymea-app/ui/appsettings/AppLogPage.qml +++ b/nymea-app/ui/appsettings/AppLogPage.qml @@ -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: diff --git a/nymea-app/ui/components/ConnectionStatusIcon.qml b/nymea-app/ui/components/ConnectionStatusIcon.qml index fe4d3cbd..2c78248d 100644 --- a/nymea-app/ui/components/ConnectionStatusIcon.qml +++ b/nymea-app/ui/components/ConnectionStatusIcon.qml @@ -29,7 +29,7 @@ ColorIcon { } color: connectedState && connectedState.value === false - ? "red" + ? Style.red : signalStrengthState && signalStrengthState.value < 20 - ? "orange" : Style.iconColor + ? Style.orange : Style.iconColor } diff --git a/nymea-app/ui/components/Led.qml b/nymea-app/ui/components/Led.qml index e0f118d3..5d057dda 100644 --- a/nymea-app/ui/components/Led.qml +++ b/nymea-app/ui/components/Led.qml @@ -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 diff --git a/nymea-app/ui/devicelistpages/SensorsDeviceListPage.qml b/nymea-app/ui/devicelistpages/SensorsDeviceListPage.qml index f60e8072..42a11d24 100644 --- a/nymea-app/ui/devicelistpages/SensorsDeviceListPage.qml +++ b/nymea-app/ui/devicelistpages/SensorsDeviceListPage.qml @@ -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) } diff --git a/nymea-app/ui/mainviews/energy/PowerBalanceStats.qml b/nymea-app/ui/mainviews/energy/PowerBalanceStats.qml index dcf81b3e..29c8ae5a 100644 --- a/nymea-app/ui/mainviews/energy/PowerBalanceStats.qml +++ b/nymea-app/ui/mainviews/energy/PowerBalanceStats.qml @@ -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)) : ""