feat: respect accent colors in more places in desktop
This commit is contained in:
@@ -8,6 +8,10 @@
|
||||
|
||||
namespace filemanager {
|
||||
|
||||
static Color selection_highlight(const DesktopState* ds) {
|
||||
return gui::mtk::accent_hover_tint(ds ? ds->settings.accent_color : colors::ACCENT);
|
||||
}
|
||||
|
||||
static bool label_break_char(char ch) {
|
||||
return ch == ' ' || ch == '-' || ch == '_' || ch == '/';
|
||||
}
|
||||
@@ -308,7 +312,7 @@ void filemanager_on_draw(Window* win, Framebuffer& fb) {
|
||||
int sh = gui_min(cell_y + row_h, c.h) - sy;
|
||||
int sw = gui_min(FM_GRID_CELL_W, c.w - FM_SCROLLBAR_W - cell_x);
|
||||
if (sh > 0 && sw > 0)
|
||||
c.fill_rect(cell_x, sy, sw, sh, colors::MENU_HOVER);
|
||||
c.fill_rect(cell_x, sy, sw, sh, selection_highlight(ds));
|
||||
}
|
||||
|
||||
// Large icon centered horizontally
|
||||
@@ -441,7 +445,7 @@ void filemanager_on_draw(Window* win, Framebuffer& fb) {
|
||||
int sy = gui_max(iy, list_y);
|
||||
int sh = gui_min(iy + FM_ITEM_H, c.h) - sy;
|
||||
if (sh > 0)
|
||||
c.fill_rect(0, sy, c.w - FM_SCROLLBAR_W, sh, colors::MENU_HOVER);
|
||||
c.fill_rect(0, sy, c.w - FM_SCROLLBAR_W, sh, selection_highlight(fm->desktop));
|
||||
}
|
||||
|
||||
// Icon (skip if it would bleed above the list area)
|
||||
@@ -582,7 +586,7 @@ void filemanager_on_draw(Window* win, Framebuffer& fb) {
|
||||
|
||||
// ---- Context menu overlay ----
|
||||
if (fm->ctx_open && fm->ctx_item_count > 0) {
|
||||
mtk::Theme theme = mtk::make_theme(colors::ACCENT);
|
||||
mtk::Theme theme = mtk::make_theme(fm->desktop ? fm->desktop->settings.accent_color : colors::ACCENT);
|
||||
theme.border = colors::BORDER;
|
||||
theme.text = colors::TEXT_COLOR;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "desktop_internal.hpp"
|
||||
#include <gui/mtk/theme.hpp>
|
||||
|
||||
// ============================================================================
|
||||
// Lock Screen Drawing
|
||||
@@ -304,7 +305,7 @@ void gui::desktop_compose(DesktopState* ds) {
|
||||
Rect item_r = {cmx + 4, iy, CTX_MENU_W - 8, CTX_ITEM_H};
|
||||
|
||||
if (item_r.contains(mmx, mmy)) {
|
||||
fill_rounded_rect(fb, item_r.x, item_r.y, item_r.w, item_r.h, 4, colors::MENU_HOVER);
|
||||
fill_rounded_rect(fb, item_r.x, item_r.y, item_r.w, item_r.h, 4, gui::mtk::accent_hover_tint(ds->settings.accent_color));
|
||||
}
|
||||
|
||||
int icon_x = item_r.x + 8;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "desktop_internal.hpp"
|
||||
#include <gui/mtk/theme.hpp>
|
||||
|
||||
static constexpr int LAUNCHER_W = 560;
|
||||
static constexpr int LAUNCHER_SEARCH_H = 52;
|
||||
@@ -17,8 +18,22 @@ static constexpr int LAUNCHER_SPECIAL_FOLDER_COUNT = 6;
|
||||
|
||||
static constexpr Color LAUNCHER_BORDER = Color::from_rgb(0xD4, 0xDB, 0xE4);
|
||||
static constexpr Color LAUNCHER_FIELD_BG = Color::from_rgb(0xFF, 0xFF, 0xFF);
|
||||
static constexpr Color LAUNCHER_SELECTED_BG = Color::from_rgb(0xDA, 0xE7, 0xFD);
|
||||
static constexpr Color LAUNCHER_HOVER_BG = Color::from_rgb(0xEC, 0xF3, 0xFE);
|
||||
static constexpr Color LAUNCHER_SELECTED_BG_DEFAULT = Color::from_rgb(0xDA, 0xE7, 0xFD);
|
||||
static constexpr Color LAUNCHER_HOVER_BG_DEFAULT = Color::from_rgb(0xEC, 0xF3, 0xFE);
|
||||
|
||||
static Color launcher_selected_bg(Color accent) {
|
||||
if (accent.r == colors::ACCENT.r && accent.g == colors::ACCENT.g
|
||||
&& accent.b == colors::ACCENT.b)
|
||||
return LAUNCHER_SELECTED_BG_DEFAULT;
|
||||
return gui::mtk::mix(colors::WHITE, accent, 47);
|
||||
}
|
||||
|
||||
static Color launcher_hover_bg(Color accent) {
|
||||
if (accent.r == colors::ACCENT.r && accent.g == colors::ACCENT.g
|
||||
&& accent.b == colors::ACCENT.b)
|
||||
return LAUNCHER_HOVER_BG_DEFAULT;
|
||||
return gui::mtk::mix(colors::WHITE, accent, 20);
|
||||
}
|
||||
static constexpr Color LAUNCHER_MUTED = Color::from_rgb(0x6F, 0x7B, 0x89);
|
||||
static constexpr Color LAUNCHER_PLACEHOLDER = Color::from_rgb(0x98, 0xA1, 0xAD);
|
||||
|
||||
@@ -589,9 +604,9 @@ void desktop_draw_launcher(DesktopState* ds) {
|
||||
bool selected = (result_idx == ds->launcher_selected);
|
||||
bool hovered = row.contains(ds->mouse.x, ds->mouse.y);
|
||||
if (selected) {
|
||||
fill_rounded_rect(fb, row.x, row.y, row.w, row.h, 8, LAUNCHER_SELECTED_BG);
|
||||
fill_rounded_rect(fb, row.x, row.y, row.w, row.h, 8, launcher_selected_bg(ds->settings.accent_color));
|
||||
} else if (hovered) {
|
||||
fill_rounded_rect(fb, row.x, row.y, row.w, row.h, 8, LAUNCHER_HOVER_BG);
|
||||
fill_rounded_rect(fb, row.x, row.y, row.w, row.h, 8, launcher_hover_bg(ds->settings.accent_color));
|
||||
}
|
||||
|
||||
if (i > 0) {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "desktop_internal.hpp"
|
||||
#include <gui/mtk/theme.hpp>
|
||||
|
||||
void gui::desktop_draw_panel(DesktopState* ds) {
|
||||
Framebuffer& fb = ds->fb;
|
||||
@@ -229,7 +230,7 @@ void desktop_draw_app_menu(DesktopState* ds) {
|
||||
|
||||
// Hover highlight
|
||||
if (item_rect.contains(mx, my)) {
|
||||
fill_rounded_rect(fb, item_rect.x, item_rect.y, item_rect.w, item_rect.h, 4, colors::MENU_HOVER);
|
||||
fill_rounded_rect(fb, item_rect.x, item_rect.y, item_rect.w, item_rect.h, 4, gui::mtk::accent_hover_tint(ds->settings.accent_color));
|
||||
}
|
||||
|
||||
// Icon
|
||||
|
||||
Reference in New Issue
Block a user