diff --git a/paint/sources/base.c b/paint/sources/base.c index 2218a755..49043b28 100644 --- a/paint/sources/base.c +++ b/paint/sources/base.c @@ -354,7 +354,7 @@ gpu_texture_t *base_get_drag_image() { gc_unroot(base_drag_rect); base_drag_rect = base_drag_layer->show_panel ? folder_open : folder_closed; gc_root(base_drag_rect); - base_drag_tint = ui->ops->theme->LABEL_COL - 0x00202020; + base_drag_tint = base_darker(ui->ops->theme->LABEL_COL, 0x00202020); return icons; } if (base_drag_layer != NULL && slot_layer_is_mask(base_drag_layer) && base_drag_layer->fill_layer == NULL) { @@ -2344,3 +2344,16 @@ void base_run_in_player() { iron_sys_command(string("%s %s --player", bin, project_filepath)); // iron_exec_async() } + +uint32_t base_darker(uint32_t x, uint32_t y) { + uint32_t r = ((x >> 16) & 0xff); + uint32_t g = ((x >> 8) & 0xff); + uint32_t b = ((x) & 0xff); + uint32_t ry = ((y >> 16) & 0xff); + uint32_t gy = ((y >> 8) & 0xff); + uint32_t by = ((y) & 0xff); + r = r > ry ? r - ry : 0; + g = g > gy ? g - gy : 0; + b = b > by ? b - by : 0; + return (x & 0xff000000) | (r << 16) | (g << 8) | b; +} diff --git a/paint/sources/functions.h b/paint/sources/functions.h index 54ba6c0c..69569d53 100644 --- a/paint/sources/functions.h +++ b/paint/sources/functions.h @@ -155,6 +155,8 @@ void base_toggle_fullscreen(); bool base_is_decal_layer(); void base_redraw_status(); void base_redraw_console(); +uint32_t base_darker(uint32_t x, uint32_t y); +void base_redraw_ui(); ui_handle_t_array_t *ui_base_init_hwnds(); ui_handle_t_array_t *ui_base_init_htabs(); tab_draw_array_t_array_t *ui_base_init_hwnd_tabs(); @@ -165,7 +167,6 @@ void ui_base_show_2d_view(view_2d_type_t type); void ui_base_show_3d_view(); void ui_base_toggle_browser(); void ui_base_set_icon_scale(); -void base_redraw_ui(); void ui_base_set_viewport_col(i32 col); void gizmo_update(); void make_texcoord_run(node_shader_t *kong); diff --git a/paint/sources/tab_layers.c b/paint/sources/tab_layers.c index 6d3c3f0b..e8e342c5 100644 --- a/paint/sources/tab_layers.c +++ b/paint/sources/tab_layers.c @@ -142,7 +142,7 @@ ui_state_t tab_layers_draw_layer_icon(slot_layer_t *l, i32 i, f32 uix, f32 uiy, rect_t *folder_closed = resource_tile50(icons, ICON_FOLDER_FULL); rect_t *folder_open = resource_tile50(icons, ICON_FOLDER_OPEN); rect_t *folder = l->show_panel ? folder_open : folder_closed; - return ui_sub_image(icons, ui->ops->theme->LABEL_COL - 0x00202020, icon_h, folder->x, folder->y, folder->w, folder->h); + return ui_sub_image(icons, base_darker(ui->ops->theme->LABEL_COL, 0x00202020), icon_h, folder->x, folder->y, folder->w, folder->h); } } @@ -975,7 +975,7 @@ void tab_layers_highlight_odd_lines() { i32 full_h = ui->_window_h - ui_base_hwnds->buffer[0]->scroll_offset; for (i32 i = 0; i < math_floor(full_h / (float)step); ++i) { if (i % 2 == 0) { - ui_fill(0, i * step, (ui->_w / (float)UI_SCALE() - 2), step, ui->ops->theme->WINDOW_BG_COL - 0x00040404); + ui_fill(0, i * step, (ui->_w / (float)UI_SCALE() - 2), step, base_darker(ui->ops->theme->WINDOW_BG_COL, 0x00040404)); } } } diff --git a/paint/sources/tab_meshes.c b/paint/sources/tab_meshes.c index a8b1988c..82e599cc 100644 --- a/paint/sources/tab_meshes.c +++ b/paint/sources/tab_meshes.c @@ -394,7 +394,7 @@ void tab_meshes_draw(ui_handle_t *htab) { gpu_texture_t *icons = resource_get("icons05x.k"); rect_t *rect = resource_tile50(icons, ICON_CUBE); i32 icon_h = 25 * UI_SCALE(); - ui_sub_image(icons, ui->ops->theme->LABEL_COL - 0x00333333, icon_h, rect->x / 2.0, rect->y / 2.0, rect->w / 2.0, rect->h / 2.0); + ui_sub_image(icons, base_darker(ui->ops->theme->LABEL_COL, 0x00333333), icon_h, rect->x / 2.0, rect->y / 2.0, rect->w / 2.0, rect->h / 2.0); mesh_object_t *o = project_paint_objects->buffer[i]; ui_handle_t *h = ui_handle(__ID__); diff --git a/paint/sources/ui_files.c b/paint/sources/ui_files.c index 1f1d9228..2bff8616 100644 --- a/paint/sources/ui_files.c +++ b/paint/sources/ui_files.c @@ -319,7 +319,7 @@ char *ui_files_file_browser(ui_handle_t *handle, bool drag_files, char *search, rect = cube; } - i32 col = rect == file ? ui->ops->theme->LABEL_COL : ui->ops->theme->LABEL_COL - 0x00202020; + i32 col = rect == file ? ui->ops->theme->LABEL_COL : base_darker(ui->ops->theme->LABEL_COL, 0x00202020); if (ui_files_selected == i) col = ui->ops->theme->HIGHLIGHT_COL; diff --git a/paint/sources/ui_menu.c b/paint/sources/ui_menu.c index f92f2236..e2b37403 100644 --- a/paint/sources/ui_menu.c +++ b/paint/sources/ui_menu.c @@ -136,7 +136,7 @@ bool ui_menu_button(char *text, char *label, icon_t icon) { ui->_x = _x_left - 2 * UI_SCALE(); ui->_y = _y_top + 2 * UI_SCALE(); } - ui_sub_image(icons, ui->ops->theme->LABEL_COL - 0x00222222, icon_h, rect->x / 2.0, rect->y / 2.0, rect->w / 2.0, rect->h / 2.0); + ui_sub_image(icons, base_darker(ui->ops->theme->LABEL_COL, 0x00222222), icon_h, rect->x / 2.0, rect->y / 2.0, rect->w / 2.0, rect->h / 2.0); ui->_x = _x_left; ui->_y = _y_bottom; } diff --git a/paint/sources/ui_nodes.c b/paint/sources/ui_nodes.c index 749a265a..6ccb3546 100644 --- a/paint/sources/ui_nodes.c +++ b/paint/sources/ui_nodes.c @@ -745,12 +745,12 @@ gpu_texture_t *ui_nodes_draw_grid(f32 zoom) { draw_begin(grid, true, ui->ops->theme->SEPARATOR_COL); i32 sep_col = ui->ops->theme->SEPARATOR_COL; - i32 line_primary = sep_col - 0x00050505; + i32 line_primary = base_darker(sep_col, 0x00050505); if (line_primary < 0xff000000) { line_primary = sep_col + 0x00050505; } - i32 line_secondary = sep_col - 0x00090909; + i32 line_secondary = base_darker(sep_col, 0x00090909); if (line_secondary < 0xff000000) { line_secondary = sep_col + 0x00090909; }