mirror of
https://github.com/gwm17/implot.git
synced 2024-11-23 02:38:53 -05:00
tweak CalcTextColor
This commit is contained in:
parent
28fedd01f9
commit
90cbb561f0
|
@ -834,7 +834,7 @@ IMPLOT_API void AddTextVertical(ImDrawList *DrawList, ImVec2 pos, ImU32 col, con
|
||||||
// Calculates the size of vertical text
|
// Calculates the size of vertical text
|
||||||
inline ImVec2 CalcTextSizeVertical(const char *text) { ImVec2 sz = ImGui::CalcTextSize(text); return ImVec2(sz.y, sz.x); }
|
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
|
// 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
|
// 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) {
|
inline ImVec2 ClampLabelPos(ImVec2 pos, const ImVec2& size, const ImVec2& Min, const ImVec2& Max) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user