Skip to content

Commit 1d69e47

Browse files
committed
Updated terminal coloring
Labels are now a static white #ffffff, while the values can still dynamically change color.
1 parent 73c5ea2 commit 1d69e47

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

src/displayapp/screens/WatchFaceTerminal.cpp

+19-18
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "displayapp/screens/WeatherSymbols.h"
1313
#include "displayapp/InfiniTimeTheme.h"
1414

15-
1615
using namespace Pinetime::Applications::Screens;
1716

1817
namespace {
@@ -55,25 +54,32 @@ WatchFaceTerminal::WatchFaceTerminal(Controllers::DateTime& dateTimeController,
5554
lv_label_set_text_static(label_prompt_1, "user@watch:~ $ now");
5655

5756
label_time = lv_label_create(lv_scr_act(), nullptr);
57+
lv_label_set_recolor(label_time, true);
5858
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -60);
5959

6060
label_date = lv_label_create(lv_scr_act(), nullptr);
61+
lv_label_set_recolor(label_date, true);
6162
lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -40);
6263

6364
weather = lv_label_create(lv_scr_act(), nullptr);
65+
lv_label_set_recolor(weather, true);
6466
lv_obj_align(weather, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -20);
6567

6668
batteryValue = lv_label_create(lv_scr_act(), nullptr);
69+
lv_label_set_recolor(batteryValue, true);
6770
lv_obj_align(batteryValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0);
6871

6972
stepValue = lv_label_create(lv_scr_act(), nullptr);
73+
lv_label_set_recolor(stepValue, true);
7074
lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::orange);
7175
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 20);
7276

7377
heartbeatValue = lv_label_create(lv_scr_act(), nullptr);
78+
lv_label_set_recolor(heartbeatValue, true);
7479
lv_obj_align(heartbeatValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 40);
7580

7681
connectState = lv_label_create(lv_scr_act(), nullptr);
82+
lv_label_set_recolor(connectState, true);
7783
lv_obj_align(connectState, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60);
7884

7985
label_prompt_2 = lv_label_create(lv_scr_act(), nullptr);
@@ -100,7 +106,6 @@ void WatchFaceTerminal::Refresh() {
100106
}
101107
}
102108

103-
104109
currentDateTime = std::chrono::time_point_cast<std::chrono::seconds>(dateTimeController.CurrentDateTime());
105110
if (currentDateTime.IsUpdated()) {
106111
uint8_t hour = dateTimeController.Hours();
@@ -117,20 +122,19 @@ void WatchFaceTerminal::Refresh() {
117122
hour = hour - 12;
118123
ampmChar[0] = 'P';
119124
}
120-
lv_label_set_text_fmt(label_time, "[TIME] %02d:%02d:%02d %s", hour, minute, second, ampmChar);
125+
lv_label_set_text_fmt(label_time, "#fffff [TIME]# #11cc55 %02d:%02d:%02d %s#", hour, minute, second, ampmChar);
121126
} else {
122-
lv_label_set_text_fmt(label_time, "[TIME] %02d:%02d:%02d", hour, minute, second);
127+
lv_label_set_text_fmt(label_time, "#ffffff [TIME]# #11cc55 %02d:%02d:%02d#", hour, minute, second);
123128
}
124129

125130
currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get());
126131
if (currentDate.IsUpdated()) {
127132
uint16_t year = dateTimeController.Year();
128133
Controllers::DateTime::Months month = dateTimeController.Month();
129134
uint8_t day = dateTimeController.Day();
130-
lv_label_set_text_fmt(label_date, "[DATE] %04d-%02d-%02d", short(year), char(month), char(day));
135+
lv_label_set_text_fmt(label_date, "#ffffff [DATE]# #007fff %04d-%02d-%02d#", short(year), char(month), char(day));
131136
}
132137
}
133-
134138

135139
currentWeather = weatherService.Current();
136140
if (currentWeather.IsUpdated()) {
@@ -144,14 +148,13 @@ void WatchFaceTerminal::Refresh() {
144148
temp = Controllers::SimpleWeatherService::CelsiusToFahrenheit(temp);
145149
tempUnit = 'F';
146150
}
147-
lv_label_set_text_fmt(weather, "[WTHR] %i°%c %s ", temp/100, tempUnit, condition);
151+
lv_label_set_text_fmt(weather, "#ffffff [WTHR]# %i°%c %s ", temp / 100, tempUnit, condition);
148152
} else {
149-
lv_label_set_text(weather, "[WTHR] ---°");
153+
lv_label_set_text(weather, "#ffffff [WTHR]# ---");
150154
lv_obj_set_style_local_text_color(weather, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::gray);
151155
}
152156
}
153157

154-
155158
powerPresent = batteryController.IsPowerPresent();
156159
batteryPercentRemaining = batteryController.PercentRemaining();
157160
if (batteryPercentRemaining.IsUpdated() || powerPresent.IsUpdated()) {
@@ -161,28 +164,26 @@ void WatchFaceTerminal::Refresh() {
161164
// charges and giving us a much nicer color range.
162165
uint8_t hue = batteryPercentRemaining.Get() * 120 / 100;
163166
lv_obj_set_style_local_text_color(batteryValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hsv_to_rgb(hue, 100, 100));
164-
lv_label_set_text_fmt(batteryValue, "[BATT] %d%%", batteryPercentRemaining.Get());
167+
lv_label_set_text_fmt(batteryValue, "#ffffff [BATT]# %d%%", batteryPercentRemaining.Get());
165168
if (batteryController.IsPowerPresent()) {
166169
lv_label_ins_text(batteryValue, LV_LABEL_POS_LAST, " Charging");
167170
}
168171
}
169172

170-
171173
stepCount = motionController.NbSteps();
172174
if (stepCount.IsUpdated()) {
173-
lv_label_set_text_fmt(stepValue, "[STEP] %lu steps", stepCount.Get());
175+
lv_label_set_text_fmt(stepValue, "#ffffff [STEP]# %lu steps", stepCount.Get());
174176
}
175177

176-
177178
heartbeat = heartRateController.HeartRate();
178179
heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped;
179180
if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) {
180181
if (heartbeatRunning.Get()) {
181182

182183
lv_obj_set_style_local_text_color(heartbeatValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::deepOrange);
183-
lv_label_set_text_fmt(heartbeatValue, "[L_HR] %d bpm", heartbeat.Get());
184+
lv_label_set_text_fmt(heartbeatValue, "#ffffff [L_HR]# %d bpm", heartbeat.Get());
184185
} else {
185-
lv_label_set_text_static(heartbeatValue, "[L_HR] ---");
186+
lv_label_set_text_static(heartbeatValue, "#ffffff [L_HR]# ---");
186187
lv_obj_set_style_local_text_color(heartbeatValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::gray);
187188
}
188189
}
@@ -191,14 +192,14 @@ void WatchFaceTerminal::Refresh() {
191192
bleRadioEnabled = bleController.IsRadioEnabled();
192193
if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) {
193194
if (!bleRadioEnabled.Get()) {
194-
lv_label_set_text_static(connectState, "[STAT] Disabled");
195+
lv_label_set_text_static(connectState, "#ffffff [STAT]# Disabled");
195196
lv_obj_set_style_local_text_color(connectState, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::gray);
196197
} else {
197198
if (bleState.Get()) {
198-
lv_label_set_text_static(connectState, "[STAT] Connected");
199+
lv_label_set_text_static(connectState, "#ffffff [STAT]# Connected");
199200
lv_obj_set_style_local_text_color(connectState, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::blue);
200201
} else {
201-
lv_label_set_text_static(connectState, "[STAT] Disconnected");
202+
lv_label_set_text_static(connectState, "#ffffff [STAT]# Disconnected");
202203
lv_obj_set_style_local_text_color(connectState, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::gray);
203204
}
204205
}

0 commit comments

Comments
 (0)