feat: respect accent colors in more places in desktop

This commit is contained in:
2026-05-24 21:29:59 +02:00
parent c731f718e9
commit 96943116f8
12 changed files with 70 additions and 20 deletions
+11 -4
View File
@@ -8,6 +8,8 @@
#include "main.hpp"
#include <gui/svg.hpp>
#include <gui/canvas.hpp>
#include <gui/mtk/theme.hpp>
#include <gui/mtk/settings.hpp>
#include <montauk/user.h>
extern "C" {
@@ -256,13 +258,14 @@ void draw_input(Canvas& c, const Rect& rect, const char* text, bool focused, int
}
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;
if (!enabled) {
bg = Color::from_rgb(0xF0, 0xF0, 0xF0);
fg = Color::from_rgb(0x9A, 0x9A, 0x9A);
} 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);
int tx = rect.x + (rect.w - text_width(label)) / 2;
@@ -827,6 +830,8 @@ void draw_grid_entries(Canvas& c, FileDialogState* st, const FileDialogLayout& l
st->scrollbar.content_height = content_h;
st->scrollbar.view_height = lo.content_rect.h;
Color sel_bg = gui::mtk::accent_hover_tint(gui::mtk::load_system_accent());
for (int i = 0; i < st->entry_count; i++) {
int col = i % cols;
int row = i / cols;
@@ -838,7 +843,7 @@ void draw_grid_entries(Canvas& c, FileDialogState* st, const FileDialogLayout& l
int sy = gui_max(cell_y, lo.content_rect.y);
int sh = gui_min(cell_y + GRID_CELL_H, lo.content_rect.y + lo.content_rect.h) - sy;
int sw = gui_min(GRID_CELL_W, c.w - SCROLLBAR_W - cell_x);
if (sh > 0 && sw > 0) c.fill_rect(cell_x, sy, sw, sh, colors::MENU_HOVER);
if (sh > 0 && sw > 0) c.fill_rect(cell_x, sy, sw, sh, sel_bg);
}
int icon_x = cell_x + (GRID_CELL_W - GRID_ICON) / 2;
@@ -888,11 +893,13 @@ void draw_list_entries(Canvas& c, FileDialogState* st, const FileDialogLayout& l
st->scrollbar.content_height = st->entry_count * ITEM_H;
st->scrollbar.view_height = rows_h;
Color sel_bg = gui::mtk::accent_hover_tint(gui::mtk::load_system_accent());
for (int i = 0; i < st->entry_count; i++) {
int y = rows_y + i * ITEM_H - st->scrollbar.scroll_offset;
if (y + ITEM_H <= rows_y || y >= rows_y + rows_h) continue;
if (i == st->selected) c.fill_rect(0, y, c.w - SCROLLBAR_W, ITEM_H, colors::MENU_HOVER);
if (i == st->selected) c.fill_rect(0, y, c.w - SCROLLBAR_W, ITEM_H, sel_bg);
int sfi = -1;
if (st->entry_types[i] == ENTRY_SPECIAL) sfi = st->drive_indices[i];