aboutsummaryrefslogtreecommitdiffstats
path: root/src/displayapp/screens/Weather.cpp
diff options
context:
space:
mode:
authorScott <development@justscott.me>2025-11-08 12:53:04 -0600
committerGitHub <noreply@github.com>2025-11-08 18:53:04 +0000
commit9093d18efc1df0be5366444fd72129dae19b2f20 (patch)
treeb7db53d54eea54e875548e8431101b2bf0dbde5a /src/displayapp/screens/Weather.cpp
parent075e02a33e7a362197f279edc015b596c4f9cd4e (diff)
Move TemperatureColor to SimpleWeatherService for reusability
Diffstat (limited to 'src/displayapp/screens/Weather.cpp')
-rw-r--r--src/displayapp/screens/Weather.cpp16
1 files changed, 1 insertions, 15 deletions
diff --git a/src/displayapp/screens/Weather.cpp b/src/displayapp/screens/Weather.cpp
index 25464c70..0e44df03 100644
--- a/src/displayapp/screens/Weather.cpp
+++ b/src/displayapp/screens/Weather.cpp
@@ -12,17 +12,6 @@
using namespace Pinetime::Applications::Screens;
namespace {
- lv_color_t TemperatureColor(Pinetime::Controllers::SimpleWeatherService::Temperature temp) {
- if (temp.Celsius() <= 0) { // freezing
- return Colors::blue;
- } else if (temp.Celsius() <= 4) { // ice
- return LV_COLOR_CYAN;
- } else if (temp.Celsius() >= 27) { // hot
- return Colors::deepOrange;
- }
- return Colors::orange; // normal
- }
-
uint8_t TemperatureStyle(Pinetime::Controllers::SimpleWeatherService::Temperature temp) {
if (temp.Celsius() <= 0) { // freezing
return LV_TABLE_PART_CELL3;
@@ -128,10 +117,7 @@ void Weather::Refresh() {
maxTemp = optCurrentWeather->maxTemperature.Fahrenheit();
tempUnit = 'F';
}
- lv_obj_set_style_local_text_color(temperature,
- LV_LABEL_PART_MAIN,
- LV_STATE_DEFAULT,
- TemperatureColor(optCurrentWeather->temperature));
+ lv_obj_set_style_local_text_color(temperature, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, optCurrentWeather->temperature.Color());
lv_label_set_text(icon, Symbols::GetSymbol(optCurrentWeather->iconId));
lv_label_set_text(condition, Symbols::GetCondition(optCurrentWeather->iconId));
lv_label_set_text_fmt(temperature, "%d°%c", temp, tempUnit);