Declare escape strings for colored text (#1409)

* Color strings

* Color strings

* Color strings

* Color strings

* Color strings

* Color strings & fix first group scrolling off screen

* Color strings

* Color strings

* Clang

* Clang

* Clang attempt #3

* Update ui_painter.cpp

* Update ui_widget.cpp

* Clang test

* Clang

* Clang test

* Update ui_about_simple.cpp

* Update lge_app.cpp
This commit is contained in:
Mark Thompson 2023-08-25 20:01:37 -05:00 committed by GitHub
parent 9af1308e29
commit cf25d85d51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 49 additions and 36 deletions

View file

@ -40,24 +40,22 @@ void RecentEntriesTable<AircraftRecentEntries>::draw(
const Rect& target_rect,
Painter& painter,
const Style& style) {
char aged_color;
Color target_color;
auto entry_age = entry.age;
std::string entry_string;
// Color decay for flights not being updated anymore
if (entry_age < ADSB_CURRENT) {
aged_color = 0x10;
entry_string = "";
target_color = Color::green();
} else if (entry_age < ADSB_RECENT) {
aged_color = 0x07;
entry_string = STR_COLOR_LIGHT_GREY;
target_color = Color::light_grey();
} else {
aged_color = 0x08;
entry_string = STR_COLOR_DARK_GREY;
target_color = Color::grey();
}
std::string entry_string = "\x1B";
entry_string += aged_color;
entry_string +=
(entry.callsign[0] != ' ' ? entry.callsign + " " : entry.icaoStr + " ") +
to_string_dec_uint((unsigned int)(entry.pos.altitude / 100), 4) +