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.
This commit is contained in:
@@ -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];
|
||||
|
||||
@@ -419,7 +419,6 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
|
||||
// ARegion *ar = ruler_info->ar;
|
||||
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;
|
||||
@@ -441,6 +440,11 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
|
||||
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);
|
||||
}
|
||||
|
||||
for (ruler_item = ruler_info->items.first, i = 0; ruler_item; ruler_item = ruler_item->next, i++) {
|
||||
const bool is_act = (i == ruler_info->item_active);
|
||||
float dir_ruler[2];
|
||||
|
||||
Reference in New Issue
Block a user