From 90cbb561f06be0634228a4030efae5fe850562ca Mon Sep 17 00:00:00 2001 From: Evan Pezent Date: Tue, 22 Sep 2020 17:23:50 -0500 Subject: [PATCH] tweak CalcTextColor --- implot_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implot_internal.h b/implot_internal.h index d5decb5..5b24038 100644 --- a/implot_internal.h +++ b/implot_internal.h @@ -834,7 +834,7 @@ IMPLOT_API void AddTextVertical(ImDrawList *DrawList, ImVec2 pos, ImU32 col, con // Calculates the size of vertical text inline ImVec2 CalcTextSizeVertical(const char *text) { ImVec2 sz = ImGui::CalcTextSize(text); return ImVec2(sz.y, sz.x); } // Returns white or black text given background color -inline ImU32 CalcTextColor(const ImVec4& bg) { return (bg.x * 0.299 + bg.y * 0.587 + bg.z * 0.114) > 0.729 ? IM_COL32_BLACK : IM_COL32_WHITE; } +inline ImU32 CalcTextColor(const ImVec4& bg) { return (bg.x * 0.299 + bg.y * 0.587 + bg.z * 0.114) > 0.5 ? IM_COL32_BLACK : IM_COL32_WHITE; } // Clamps a label position so that it fits a rect defined by Min/Max inline ImVec2 ClampLabelPos(ImVec2 pos, const ImVec2& size, const ImVec2& Min, const ImVec2& Max) {