Consolidate styles (#1116)

* Consolidate styles into a Styles class and clean up code

* Format

* Add style_bg_dark_grey for nav bar

* Fix bugs found in PR

* Rename styles

* Add bg_white style

---------

Co-authored-by: kallanreed <kallanreed@outlook.com>
Co-authored-by: gullradriel <3157857+gullradriel@users.noreply.github.com>
This commit is contained in:
Kyle Reed 2023-06-07 08:33:32 -07:00 committed by GitHub
parent 496b124baf
commit 0f28fefc82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 299 additions and 400 deletions

View file

@ -26,9 +26,9 @@
#include "ui.hpp"
#include "ui_navigation.hpp"
#include "ui_painter.hpp"
#include "ui_styles.hpp"
#include "ui_widget.hpp"
#include "ui_receiver.hpp"
#include "ui_font_fixed_8x16.hpp"
#include "rf_path.hpp"
@ -73,36 +73,12 @@ class TransmitterView : public View {
void set_transmitting(const bool transmitting);
private:
const Style style_start{
.font = font::fixed_8x16,
.background = Color::black(),
.foreground = Color::green(),
};
const Style style_stop{
.font = font::fixed_8x16,
.background = Color::black(),
.foreground = Color::red(),
};
const Style style_locked{
.font = font::fixed_8x16,
.background = Color::black(),
.foreground = Color::dark_grey(),
};
const Style style_power_low{
.font = font::fixed_8x16,
.background = Color::black(),
.foreground = Color::yellow(),
};
const Style style_power_med{
.font = font::fixed_8x16,
.background = Color::black(),
.foreground = Color::orange(),
};
const Style style_power_high{
.font = font::fixed_8x16,
.background = Color::black(),
.foreground = Color::red(),
};
const Style& style_start = Styles::green;
const Style style_stop = Styles::red;
const Style style_locked = Styles::dark_grey;
const Style style_power_low = Styles::yellow;
const Style style_power_med = Styles::orange;
const Style style_power_high = Styles::red;
bool lock_{false};
bool transmitting_{false};
@ -168,21 +144,9 @@ class TransmitterView2 : public View {
void paint(Painter& painter) override;
private:
const Style style_power_low{
.font = font::fixed_8x16,
.background = Color::black(),
.foreground = Color::yellow(),
};
const Style style_power_med{
.font = font::fixed_8x16,
.background = Color::black(),
.foreground = Color::orange(),
};
const Style style_power_high{
.font = font::fixed_8x16,
.background = Color::black(),
.foreground = Color::red(),
};
const Style& style_power_low = Styles::yellow;
const Style& style_power_med = Styles::orange;
const Style& style_power_high = Styles::red;
Text text_gain_amp{
{0, 3 * 8, 5 * 8, 1 * 16},