feat: respect accent color in print dialogs
This commit is contained in:
@@ -8,6 +8,8 @@
|
|||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
#include <gui/svg.hpp>
|
#include <gui/svg.hpp>
|
||||||
#include <gui/canvas.hpp>
|
#include <gui/canvas.hpp>
|
||||||
|
#include <gui/mtk/theme.hpp>
|
||||||
|
#include <gui/mtk/settings.hpp>
|
||||||
#include <print/print.hpp>
|
#include <print/print.hpp>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -98,13 +100,14 @@ void fit_text_end(const char* src, char* out, int out_len, int max_px) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void draw_action_button(Canvas& c, const Rect& rect, const char* label, bool enabled, bool hovered, bool primary) {
|
void draw_action_button(Canvas& c, const Rect& rect, const char* label, bool enabled, bool hovered, bool primary) {
|
||||||
Color bg = primary ? colors::ACCENT : Color::from_rgb(0xE8, 0xE8, 0xE8);
|
Color accent = gui::mtk::load_system_accent();
|
||||||
|
Color bg = primary ? accent : Color::from_rgb(0xE8, 0xE8, 0xE8);
|
||||||
Color fg = primary ? colors::WHITE : colors::TEXT_COLOR;
|
Color fg = primary ? colors::WHITE : colors::TEXT_COLOR;
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
bg = Color::from_rgb(0xF0, 0xF0, 0xF0);
|
bg = Color::from_rgb(0xF0, 0xF0, 0xF0);
|
||||||
fg = Color::from_rgb(0x9A, 0x9A, 0x9A);
|
fg = Color::from_rgb(0x9A, 0x9A, 0x9A);
|
||||||
} else if (hovered) {
|
} else if (hovered) {
|
||||||
bg = primary ? Color::from_rgb(0x2B, 0x6B, 0xE0) : Color::from_rgb(0xDC, 0xDC, 0xDC);
|
bg = primary ? gui::mtk::darken(accent, 32) : Color::from_rgb(0xDC, 0xDC, 0xDC);
|
||||||
}
|
}
|
||||||
c.fill_rounded_rect(rect.x, rect.y, rect.w, rect.h, 4, bg);
|
c.fill_rounded_rect(rect.x, rect.y, rect.w, rect.h, 4, bg);
|
||||||
int tx = rect.x + (rect.w - text_width(label)) / 2;
|
int tx = rect.x + (rect.w - text_width(label)) / 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user