1
0
Fork 0
mirror of https://github.com/gwm17/implot.git synced 2024-10-09 23:57:26 -04:00

add StyleColorsX

This commit is contained in:
epezent 2020-08-24 11:06:29 -05:00
parent 044ac47f51
commit 30ffe79d1d
3 changed files with 183 additions and 47 deletions

View File

@ -118,31 +118,7 @@ ImPlotStyle::ImPlotStyle() {
InfoPadding = ImVec2(10,10); InfoPadding = ImVec2(10,10);
PlotMinSize = ImVec2(300,225); PlotMinSize = ImVec2(300,225);
Colors[ImPlotCol_Line] = IMPLOT_COL_AUTO; ImPlot::StyleColorsAuto(this);
Colors[ImPlotCol_Fill] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_MarkerOutline] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_MarkerFill] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_ErrorBar] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_FrameBg] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_PlotBg] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_PlotBorder] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_LegendBg] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_LegendBorder] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_LegendText] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_TitleText] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_InlayText] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_PlotBorder] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_XAxis] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_XAxisGrid] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_YAxis] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_YAxisGrid] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_YAxis2] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_YAxisGrid2] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_YAxis3] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_YAxisGrid3] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_Selection] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_Query] = IMPLOT_COL_AUTO;
Colors[ImPlotCol_Crosshairs] = IMPLOT_COL_AUTO;
} }
namespace ImPlot { namespace ImPlot {
@ -187,7 +163,7 @@ ImVec4 GetAutoColor(ImPlotCol idx) {
case ImPlotCol_ErrorBar: return ImGui::GetStyleColorVec4(ImGuiCol_Text); case ImPlotCol_ErrorBar: return ImGui::GetStyleColorVec4(ImGuiCol_Text);
case ImPlotCol_FrameBg: return ImGui::GetStyleColorVec4(ImGuiCol_FrameBg); case ImPlotCol_FrameBg: return ImGui::GetStyleColorVec4(ImGuiCol_FrameBg);
case ImPlotCol_PlotBg: return ImGui::GetStyleColorVec4(ImGuiCol_WindowBg); case ImPlotCol_PlotBg: return ImGui::GetStyleColorVec4(ImGuiCol_WindowBg);
case ImPlotCol_PlotBorder: return ImGui::GetStyleColorVec4(ImGuiCol_Text) * ImVec4(1,1,1,0.50f); case ImPlotCol_PlotBorder: return ImGui::GetStyleColorVec4(ImGuiCol_Border);
case ImPlotCol_LegendBg: return ImGui::GetStyleColorVec4(ImGuiCol_PopupBg); case ImPlotCol_LegendBg: return ImGui::GetStyleColorVec4(ImGuiCol_PopupBg);
case ImPlotCol_LegendBorder: return GetStyleColorVec4(ImPlotCol_PlotBorder); case ImPlotCol_LegendBorder: return GetStyleColorVec4(ImPlotCol_PlotBorder);
case ImPlotCol_LegendText: return GetStyleColorVec4(ImPlotCol_InlayText); case ImPlotCol_LegendText: return GetStyleColorVec4(ImPlotCol_InlayText);
@ -2074,7 +2050,7 @@ void SetColormap(const ImVec4* colors, int size) {
} }
const ImVec4* GetColormap(ImPlotColormap colormap, int* size_out) { const ImVec4* GetColormap(ImPlotColormap colormap, int* size_out) {
static const int csizes[ImPlotColormap_COUNT] = {10,9,9,12,10,11,11,11,11,11,11}; static const int csizes[ImPlotColormap_COUNT] = {10,10,9,9,12,11,11,11,11,11,11};
static const ImOffsetCalculator<ImPlotColormap_COUNT> coffs(csizes); static const ImOffsetCalculator<ImPlotColormap_COUNT> coffs(csizes);
static ImVec4 cdata[] = { static ImVec4 cdata[] = {
// ImPlotColormap_Default // X11 Named Colors // ImPlotColormap_Default // X11 Named Colors
@ -2088,6 +2064,17 @@ const ImVec4* GetColormap(ImPlotColormap colormap, int* size_out) {
ImVec4(0.5411764979f, 0.1686274558f, 0.8862745166f, 1.0f), // Purples::BlueViolet, ImVec4(0.5411764979f, 0.1686274558f, 0.8862745166f, 1.0f), // Purples::BlueViolet,
ImVec4(0.5f, 0.5f, 0.5f, 1.0f), // Grays::Gray50, ImVec4(0.5f, 0.5f, 0.5f, 1.0f), // Grays::Gray50,
ImVec4(0.8235294223f, 0.7058823705f, 0.5490196347f, 1.0f), // Browns::Tan ImVec4(0.8235294223f, 0.7058823705f, 0.5490196347f, 1.0f), // Browns::Tan
// ImPlotColormap_Deep
ImVec4(0.298f, 0.447f, 0.690f, 1.000f),
ImVec4(0.867f, 0.518f, 0.322f, 1.000f),
ImVec4(0.333f, 0.659f, 0.408f, 1.000f),
ImVec4(0.769f, 0.306f, 0.322f, 1.000f),
ImVec4(0.506f, 0.446f, 0.702f, 1.000f),
ImVec4(0.576f, 0.471f, 0.376f, 1.000f),
ImVec4(0.855f, 0.545f, 0.765f, 1.000f),
ImVec4(0.549f, 0.549f, 0.549f, 1.000f),
ImVec4(0.800f, 0.725f, 0.455f, 1.000f),
ImVec4(0.392f, 0.710f, 0.804f, 1.000f),
// ImPlotColormap_Dark // ImPlotColormap_Dark
ImVec4(0.894118f, 0.101961f, 0.109804f, 1.0f), ImVec4(0.894118f, 0.101961f, 0.109804f, 1.0f),
ImVec4(0.215686f, 0.494118f, 0.721569f, 1.0f), ImVec4(0.215686f, 0.494118f, 0.721569f, 1.0f),
@ -2121,17 +2108,6 @@ const ImVec4* GetColormap(ImPlotColormap colormap, int* size_out) {
ImVec4(0.415686f, 0.239216f, 0.603922f, 1.0f), ImVec4(0.415686f, 0.239216f, 0.603922f, 1.0f),
ImVec4(1.000000f, 1.000000f, 0.600000f, 1.0f), ImVec4(1.000000f, 1.000000f, 0.600000f, 1.0f),
ImVec4(0.694118f, 0.349020f, 0.156863f, 1.0f), ImVec4(0.694118f, 0.349020f, 0.156863f, 1.0f),
// ImPlotColormap_Deep
ImVec4(0.298f, 0.447f, 0.690f, 1.000f),
ImVec4(0.867f, 0.518f, 0.322f, 1.000f),
ImVec4(0.333f, 0.659f, 0.408f, 1.000f),
ImVec4(0.769f, 0.306f, 0.322f, 1.000f),
ImVec4(0.506f, 0.446f, 0.702f, 1.000f),
ImVec4(0.576f, 0.471f, 0.376f, 1.000f),
ImVec4(0.855f, 0.545f, 0.765f, 1.000f),
ImVec4(0.549f, 0.549f, 0.549f, 1.000f),
ImVec4(0.800f, 0.725f, 0.455f, 1.000f),
ImVec4(0.392f, 0.710f, 0.804f, 1.000f),
// ImPlotColormap_Viridis // ImPlotColormap_Viridis
ImVec4(0.267004f, 0.004874f, 0.329415f, 1.0f), ImVec4(0.267004f, 0.004874f, 0.329415f, 1.0f),
ImVec4(0.282623f, 0.140926f, 0.457517f, 1.0f), ImVec4(0.282623f, 0.140926f, 0.457517f, 1.0f),
@ -2210,7 +2186,7 @@ const ImVec4* GetColormap(ImPlotColormap colormap, int* size_out) {
} }
const char* GetColormapName(ImPlotColormap colormap) { const char* GetColormapName(ImPlotColormap colormap) {
static const char* cmap_names[] = {"Default","Dark","Pastel","Paired","Deep","Viridis","Plasma","Hot","Cool","Pink","Jet"}; static const char* cmap_names[] = {"Default","Deep","Dark","Pastel","Paired","Viridis","Plasma","Hot","Cool","Pink","Jet"};
return cmap_names[colormap]; return cmap_names[colormap];
} }
@ -2326,6 +2302,23 @@ static void HelpMarker(const char* desc) {
} }
} }
bool ShowStyleSelector(const char* label)
{
static int style_idx = -1;
if (ImGui::Combo(label, &style_idx, "Auto\0Classic\0Dark\0Light\0"))
{
switch (style_idx)
{
case 0: StyleColorsAuto(); break;
case 1: StyleColorsClassic(); break;
case 2: StyleColorsDark(); break;
case 3: StyleColorsLight(); break;
}
return true;
}
return false;
}
void ShowStyleEditor(ImPlotStyle* ref) { void ShowStyleEditor(ImPlotStyle* ref) {
ImPlotContext& gp = *GImPlot; ImPlotContext& gp = *GImPlot;
ImPlotStyle& style = GetStyle(); ImPlotStyle& style = GetStyle();
@ -2337,6 +2330,10 @@ void ShowStyleEditor(ImPlotStyle* ref) {
init = false; init = false;
if (ref == NULL) if (ref == NULL)
ref = &ref_saved_style; ref = &ref_saved_style;
if (ImPlot::ShowStyleSelector("Colors##Selector"))
ref_saved_style = style;
// Save/Revert button // Save/Revert button
if (ImGui::Button("Save Ref")) if (ImGui::Button("Save Ref"))
*ref = ref_saved_style = style; *ref = ref_saved_style = style;
@ -2575,5 +2572,133 @@ void ShowUserGuide() {
ImGui::BulletText("Click legend label icons to show/hide plot items."); ImGui::BulletText("Click legend label icons to show/hide plot items.");
} }
void StyleColorsAuto(ImPlotStyle* dst) {
ImPlotStyle* style = dst ? dst : &ImPlot::GetStyle();
ImVec4* colors = style->Colors;
style->MinorAlpha = 0.25f;
colors[ImPlotCol_Line] = IMPLOT_COL_AUTO;
colors[ImPlotCol_Fill] = IMPLOT_COL_AUTO;
colors[ImPlotCol_MarkerOutline] = IMPLOT_COL_AUTO;
colors[ImPlotCol_MarkerFill] = IMPLOT_COL_AUTO;
colors[ImPlotCol_ErrorBar] = IMPLOT_COL_AUTO;
colors[ImPlotCol_FrameBg] = IMPLOT_COL_AUTO;
colors[ImPlotCol_PlotBg] = IMPLOT_COL_AUTO;
colors[ImPlotCol_PlotBorder] = IMPLOT_COL_AUTO;
colors[ImPlotCol_LegendBg] = IMPLOT_COL_AUTO;
colors[ImPlotCol_LegendBorder] = IMPLOT_COL_AUTO;
colors[ImPlotCol_LegendText] = IMPLOT_COL_AUTO;
colors[ImPlotCol_TitleText] = IMPLOT_COL_AUTO;
colors[ImPlotCol_InlayText] = IMPLOT_COL_AUTO;
colors[ImPlotCol_PlotBorder] = IMPLOT_COL_AUTO;
colors[ImPlotCol_XAxis] = IMPLOT_COL_AUTO;
colors[ImPlotCol_XAxisGrid] = IMPLOT_COL_AUTO;
colors[ImPlotCol_YAxis] = IMPLOT_COL_AUTO;
colors[ImPlotCol_YAxisGrid] = IMPLOT_COL_AUTO;
colors[ImPlotCol_YAxis2] = IMPLOT_COL_AUTO;
colors[ImPlotCol_YAxisGrid2] = IMPLOT_COL_AUTO;
colors[ImPlotCol_YAxis3] = IMPLOT_COL_AUTO;
colors[ImPlotCol_YAxisGrid3] = IMPLOT_COL_AUTO;
colors[ImPlotCol_Selection] = IMPLOT_COL_AUTO;
colors[ImPlotCol_Query] = IMPLOT_COL_AUTO;
colors[ImPlotCol_Crosshairs] = IMPLOT_COL_AUTO;
}
void StyleColorsClassic(ImPlotStyle* dst) {
ImPlotStyle* style = dst ? dst : &ImPlot::GetStyle();
ImVec4* colors = style->Colors;
style->MinorAlpha = 0.5f;
colors[ImPlotCol_Line] = IMPLOT_COL_AUTO;
colors[ImPlotCol_Fill] = IMPLOT_COL_AUTO;
colors[ImPlotCol_MarkerOutline] = IMPLOT_COL_AUTO;
colors[ImPlotCol_MarkerFill] = IMPLOT_COL_AUTO;
colors[ImPlotCol_ErrorBar] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
colors[ImPlotCol_FrameBg] = ImVec4(0.43f, 0.43f, 0.43f, 0.39f);
colors[ImPlotCol_PlotBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.35f);
colors[ImPlotCol_PlotBorder] = ImVec4(0.50f, 0.50f, 0.50f, 0.50f);
colors[ImPlotCol_LegendBg] = ImVec4(0.11f, 0.11f, 0.14f, 0.92f);
colors[ImPlotCol_LegendBorder] = ImVec4(0.50f, 0.50f, 0.50f, 0.50f);
colors[ImPlotCol_LegendText] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
colors[ImPlotCol_TitleText] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
colors[ImPlotCol_InlayText] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
colors[ImPlotCol_XAxis] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
colors[ImPlotCol_XAxisGrid] = ImVec4(0.90f, 0.90f, 0.90f, 0.25f);
colors[ImPlotCol_YAxis] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
colors[ImPlotCol_YAxisGrid] = ImVec4(0.90f, 0.90f, 0.90f, 0.25f);
colors[ImPlotCol_YAxis2] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
colors[ImPlotCol_YAxisGrid2] = ImVec4(0.90f, 0.90f, 0.90f, 0.25f);
colors[ImPlotCol_YAxis3] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
colors[ImPlotCol_YAxisGrid3] = ImVec4(0.90f, 0.90f, 0.90f, 0.25f);
colors[ImPlotCol_Selection] = ImVec4(0.97f, 0.97f, 0.39f, 1.00f);
colors[ImPlotCol_Query] = ImVec4(0.00f, 1.00f, 0.59f, 1.00f);
colors[ImPlotCol_Crosshairs] = ImVec4(0.50f, 0.50f, 0.50f, 0.75f);
}
void StyleColorsDark(ImPlotStyle* dst) {
ImPlotStyle* style = dst ? dst : &ImPlot::GetStyle();
ImVec4* colors = style->Colors;
style->MinorAlpha = 0.25f;
colors[ImPlotCol_Line] = IMPLOT_COL_AUTO;
colors[ImPlotCol_Fill] = IMPLOT_COL_AUTO;
colors[ImPlotCol_MarkerOutline] = IMPLOT_COL_AUTO;
colors[ImPlotCol_MarkerFill] = IMPLOT_COL_AUTO;
colors[ImPlotCol_ErrorBar] = IMPLOT_COL_AUTO;
colors[ImPlotCol_FrameBg] = ImVec4(1.00f, 1.00f, 1.00f, 0.07f);
colors[ImPlotCol_PlotBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.50f);
colors[ImPlotCol_PlotBorder] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f);
colors[ImPlotCol_LegendBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.94f);
colors[ImPlotCol_LegendBorder] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f);
colors[ImPlotCol_LegendText] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImPlotCol_TitleText] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImPlotCol_InlayText] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImPlotCol_XAxis] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImPlotCol_XAxisGrid] = ImVec4(1.00f, 1.00f, 1.00f, 0.25f);
colors[ImPlotCol_YAxis] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImPlotCol_YAxisGrid] = ImVec4(1.00f, 1.00f, 1.00f, 0.25f);
colors[ImPlotCol_YAxis2] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImPlotCol_YAxisGrid2] = ImVec4(1.00f, 1.00f, 1.00f, 0.25f);
colors[ImPlotCol_YAxis3] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImPlotCol_YAxisGrid3] = ImVec4(1.00f, 1.00f, 1.00f, 0.25f);
colors[ImPlotCol_Selection] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
colors[ImPlotCol_Query] = ImVec4(0.00f, 1.00f, 0.44f, 1.00f);
colors[ImPlotCol_Crosshairs] = ImVec4(1.00f, 1.00f, 1.00f, 0.50f);
}
void StyleColorsLight(ImPlotStyle* dst) {
ImPlotStyle* style = dst ? dst : &ImPlot::GetStyle();
ImVec4* colors = style->Colors;
style->MinorAlpha = 1.0f;
colors[ImPlotCol_Line] = IMPLOT_COL_AUTO;
colors[ImPlotCol_Fill] = IMPLOT_COL_AUTO;
colors[ImPlotCol_MarkerOutline] = IMPLOT_COL_AUTO;
colors[ImPlotCol_MarkerFill] = IMPLOT_COL_AUTO;
colors[ImPlotCol_ErrorBar] = IMPLOT_COL_AUTO;
colors[ImPlotCol_FrameBg] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImPlotCol_PlotBg] = ImVec4(0.42f, 0.57f, 1.00f, 0.13f);
colors[ImPlotCol_PlotBorder] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
colors[ImPlotCol_LegendBg] = ImVec4(1.00f, 1.00f, 1.00f, 0.98f);
colors[ImPlotCol_LegendBorder] = ImVec4(0.82f, 0.82f, 0.82f, 0.80f);
colors[ImPlotCol_LegendText] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
colors[ImPlotCol_TitleText] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
colors[ImPlotCol_InlayText] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
colors[ImPlotCol_XAxis] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
colors[ImPlotCol_XAxisGrid] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImPlotCol_YAxis] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
colors[ImPlotCol_YAxisGrid] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImPlotCol_YAxis2] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
colors[ImPlotCol_YAxisGrid2] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImPlotCol_YAxis3] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
colors[ImPlotCol_YAxisGrid3] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImPlotCol_Selection] = ImVec4(0.82f, 0.64f, 0.03f, 1.00f);
colors[ImPlotCol_Query] = ImVec4(0.00f, 0.84f, 0.37f, 1.00f);
colors[ImPlotCol_Crosshairs] = ImVec4(0.00f, 0.00f, 0.00f, 0.50f);
}
} // namespace ImPlot } // namespace ImPlot

View File

@ -83,7 +83,7 @@ enum ImPlotCol_ {
// plot related colors // plot related colors
ImPlotCol_FrameBg, // plot frame background color (defaults to ImGuiCol_FrameBg) ImPlotCol_FrameBg, // plot frame background color (defaults to ImGuiCol_FrameBg)
ImPlotCol_PlotBg, // plot area background color (defaults to ImGuiCol_WindowBg) ImPlotCol_PlotBg, // plot area background color (defaults to ImGuiCol_WindowBg)
ImPlotCol_PlotBorder, // plot area border color (defaults to 50% ImGuiCol_Text) ImPlotCol_PlotBorder, // plot area border color (defaults to ImGuiCol_Border)
ImPlotCol_LegendBg, // legend background color (defaults to ImGuiCol_PopupBg) ImPlotCol_LegendBg, // legend background color (defaults to ImGuiCol_PopupBg)
ImPlotCol_LegendBorder, // legend border color (defaults to ImPlotCol_PlotBorder) ImPlotCol_LegendBorder, // legend border color (defaults to ImPlotCol_PlotBorder)
ImPlotCol_LegendText, // legend text color (defaults to ImPlotCol_InlayText) ImPlotCol_LegendText, // legend text color (defaults to ImPlotCol_InlayText)
@ -150,10 +150,10 @@ enum ImPlotMarker_ {
// Built-in colormaps // Built-in colormaps
enum ImPlotColormap_ { enum ImPlotColormap_ {
ImPlotColormap_Default = 0, // ImPlot default colormap (n=10) ImPlotColormap_Default = 0, // ImPlot default colormap (n=10)
ImPlotColormap_Dark = 1, // a.k.a. matplotlib "Set1" (n=9) ImPlotColormap_Deep = 1, // a.k.a. seaborn deep (n=10)
ImPlotColormap_Pastel = 2, // a.k.a. matplotlib "Pastel1" (n=9) ImPlotColormap_Dark = 2, // a.k.a. matplotlib "Set1" (n=9)
ImPlotColormap_Paired = 3, // a.k.a. matplotlib "Paired" (n=12) ImPlotColormap_Pastel = 3, // a.k.a. matplotlib "Pastel1" (n=9)
ImPlotColormap_Deep = 4, // a.k.a. seaborn deep (n=10) ImPlotColormap_Paired = 4, // a.k.a. matplotlib "Paired" (n=12)
ImPlotColormap_Viridis = 5, // a.k.a. matplotlib "viridis" (n=11) ImPlotColormap_Viridis = 5, // a.k.a. matplotlib "viridis" (n=11)
ImPlotColormap_Plasma = 6, // a.k.a. matplotlib "plasma" (n=11) ImPlotColormap_Plasma = 6, // a.k.a. matplotlib "plasma" (n=11)
ImPlotColormap_Hot = 7, // a.k.a. matplotlib/MATLAB "hot" (n=11) ImPlotColormap_Hot = 7, // a.k.a. matplotlib/MATLAB "hot" (n=11)
@ -418,6 +418,15 @@ bool IsLegendEntryHovered(const char* label_id);
// Provides access to plot style structure for permanant modifications to colors, sizes, etc. // Provides access to plot style structure for permanant modifications to colors, sizes, etc.
ImPlotStyle& GetStyle(); ImPlotStyle& GetStyle();
// Style colors from current ImGui style (default)
void StyleColorsAuto(ImPlotStyle* dst = NULL);
// Style colors for ImGui "Classic".
void StyleColorsClassic(ImPlotStyle* dst = NULL);
// Style colors for ImGui "Dark".
void StyleColorsDark(ImPlotStyle* dst = NULL);
// Style colors for ImGui "Light".
void StyleColorsLight(ImPlotStyle* dst = NULL);
// Special color used to indicate that a style color should be deduced automatically from ImGui style or ImPlot colormaps. // Special color used to indicate that a style color should be deduced automatically from ImGui style or ImPlot colormaps.
#define IMPLOT_COL_AUTO ImVec4(0,0,0,-1) #define IMPLOT_COL_AUTO ImVec4(0,0,0,-1)
@ -471,6 +480,8 @@ void ShowColormapScale(double scale_min, double scale_max, float height);
// Allows changing how keyboard/mouse interaction works. // Allows changing how keyboard/mouse interaction works.
ImPlotInputMap& GetInputMap(); ImPlotInputMap& GetInputMap();
// Shows ImPlot style selector dropdown menu.
bool ShowStyleSelector(const char* label);
// Shows ImPlot style editor block (not a window) // Shows ImPlot style editor block (not a window)
void ShowStyleEditor(ImPlotStyle* ref = NULL); void ShowStyleEditor(ImPlotStyle* ref = NULL);
// Add basic help/info block (not a window): how to manipulate ImPlot as a end-user // Add basic help/info block (not a window): how to manipulate ImPlot as a end-user

View File

@ -270,7 +270,7 @@ void ShowDemoWindow(bool* p_open) {
static float alpha = 0.25f; static float alpha = 0.25f;
ImGui::DragFloat("Alpha",&alpha,0.01f,0,1); ImGui::DragFloat("Alpha",&alpha,0.01f,0,1);
if (ImPlot::BeginPlot("Shaded Plots")) { if (ImPlot::BeginPlot("Shaded Plots", "X-Axis", "Y-Axis")) {
ImPlot::PushStyleVar(ImPlotStyleVar_FillAlpha, alpha); ImPlot::PushStyleVar(ImPlotStyleVar_FillAlpha, alpha);
ImPlot::PlotShaded("Uncertain Data",xs,ys1,ys2,1001); ImPlot::PlotShaded("Uncertain Data",xs,ys1,ys2,1001);
ImPlot::PlotLine("Uncertain Data", xs, ys, 1001); ImPlot::PlotLine("Uncertain Data", xs, ys, 1001);
@ -1141,9 +1141,9 @@ void StyleSeaborn() {
colors[ImPlotCol_MarkerFill] = IMPLOT_COL_AUTO; colors[ImPlotCol_MarkerFill] = IMPLOT_COL_AUTO;
colors[ImPlotCol_ErrorBar] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f); colors[ImPlotCol_ErrorBar] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
colors[ImPlotCol_FrameBg] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); colors[ImPlotCol_FrameBg] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImPlotCol_PlotBg] = ImVec4(0.93f, 0.93f, 0.98f, 1.00f); colors[ImPlotCol_PlotBg] = ImVec4(0.92f, 0.92f, 0.95f, 1.00f);
colors[ImPlotCol_PlotBorder] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); colors[ImPlotCol_PlotBorder] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
colors[ImPlotCol_LegendBg] = ImVec4(0.93f, 0.93f, 0.98f, 1.00f); colors[ImPlotCol_LegendBg] = ImVec4(0.92f, 0.92f, 0.95f, 1.00f);
colors[ImPlotCol_LegendBorder] = ImVec4(0.80f, 0.81f, 0.85f, 1.00f); colors[ImPlotCol_LegendBorder] = ImVec4(0.80f, 0.81f, 0.85f, 1.00f);
colors[ImPlotCol_LegendText] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f); colors[ImPlotCol_LegendText] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
colors[ImPlotCol_TitleText] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f); colors[ImPlotCol_TitleText] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);