From 499dbb626acb816de1dcbca10fdb2d8ca27dbcc9 Mon Sep 17 00:00:00 2001 From: Pablo Vazquez Date: Tue, 21 Sep 2021 18:33:14 +0200 Subject: UI: Style drag-drop indicators as tooltips Currently, the drop indicator colors are hardcoded to white text on semi-transparent black background. This patch makes the drop indicator use the tooltip theme settings, as they serve a similar purpose. {F10530482, size=full} All built-in themes seem to work well and got improved readability. Reviewed By: HooglyBoogly Differential Revision: https://developer.blender.org/D12588 --- source/blender/windowmanager/intern/wm_dragdrop.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index 76bb93b681c..b6a04251ffb 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -34,6 +34,7 @@ #include "BLT_translation.h" #include "BLI_blenlib.h" +#include "BLI_math_color.h" #include "BIF_glutil.h" @@ -50,6 +51,7 @@ #include "UI_interface.h" #include "UI_interface_icons.h" +#include "UI_resources.h" #include "RNA_access.h" @@ -463,8 +465,14 @@ void WM_drag_free_imported_drag_ID(struct Main *bmain, wmDrag *drag, wmDropBox * static void wm_drop_operator_draw(const char *name, int x, int y) { const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; - const float col_fg[4] = {1.0f, 1.0f, 1.0f, 1.0f}; - const float col_bg[4] = {0.0f, 0.0f, 0.0f, 0.2f}; + + /* Use the theme settings from tooltips. */ + const bTheme *btheme = UI_GetTheme(); + const uiWidgetColors *wcol = &btheme->tui.wcol_tooltip; + + float col_fg[4], col_bg[4]; + rgba_uchar_to_float(col_fg, wcol->text); + rgba_uchar_to_float(col_bg, wcol->inner); UI_fontstyle_draw_simple_backdrop(fstyle, x, y, name, col_fg, col_bg); } -- cgit v1.2.3