From 150218e58b24e2e1d61d9f7321d6148b54a54be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sat, 10 Nov 2018 18:40:59 +0100 Subject: Ruler Tool: Fix non readable text The ruler tool is using a hard coded background color. Invert it if the text color is bright. In the future we should maybe use a theme color instead of guessing as it does not work well with middle gray colors. --- source/blender/editors/space_view3d/view3d_gizmo_ruler.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/space_view3d/view3d_gizmo_ruler.c') diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c index f35b88950d7..34709e434ac 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c @@ -507,7 +507,6 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz) RegionView3D *rv3d = ar->regiondata; const float cap_size = 4.0f; const float bg_margin = 4.0f * U.pixelsize; - const float bg_radius = 4.0f * U.pixelsize; const float arc_size = 64.0f * U.pixelsize; #define ARC_STEPS 24 const int arc_steps = ARC_STEPS; @@ -528,6 +527,11 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz) UI_GetThemeColor3ubv(TH_TEXT, color_text); UI_GetThemeColor3ubv(TH_WIRE, color_wire); + /* Avoid white on white text. (TODO Fix by using theme) */ + if ((int)color_text[0] + (int)color_text[1] + (int)color_text[2] > 127 * 3 * 0.6f) { + copy_v3_fl(color_back, 0.0f); + } + const bool is_act = (gz->flag & WM_GIZMO_DRAW_HOVER); float dir_ruler[2]; float co_ss[3][2]; -- cgit v1.2.3