From 510366e12e356efc65642e1b2fd769027e4aec60 Mon Sep 17 00:00:00 2001 From: epezent Date: Sun, 16 Aug 2020 00:24:09 -0500 Subject: [PATCH] document and demo PlotText colors --- implot.h | 2 +- implot_demo.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/implot.h b/implot.h index 99c446a..2ce98ce 100644 --- a/implot.h +++ b/implot.h @@ -280,7 +280,7 @@ void PlotDigital(const char* label_id, const float* xs, const float* ys, int cou void PlotDigital(const char* label_id, const double* xs, const double* ys, int count, int offset = 0, int stride = sizeof(double)); void PlotDigital(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, int offset = 0); -// Plots a text label at point x,y. +// Plots a text label at point x,y. Text color can be changed with ImGui::PushStyleColor(ImGuiCol_Text, ...). void PlotText(const char* text, float x, float y, bool vertical = false, const ImVec2& pixel_offset = ImVec2(0,0)); void PlotText(const char* text, double x, double y, bool vertical = false, const ImVec2& pixel_offset = ImVec2(0,0)); diff --git a/implot_demo.cpp b/implot_demo.cpp index f6cedba..88fb004 100644 --- a/implot_demo.cpp +++ b/implot_demo.cpp @@ -540,7 +540,10 @@ void ShowDemoWindow(bool* p_open) { ImPlot::PlotText("Filled Markers", 1.5, 11.75); ImPlot::PlotText("Open Markers", 6.75, 11.75); + + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0,1,0,1)); ImPlot::PlotText("Fancy Markers", 4.5, 4.25, true); + ImGui::PopStyleColor(); ImPlot::SetColormap(ImPlotColormap_Default);