MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / resetStyle

Function resetStyle

plugins/Cardinal/src/ImGuiWidget.cpp:203–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201 }
202
203 void resetStyle()
204 {
205 ImGuiStyle& style(ImGui::GetStyle());
206
207 style.FrameRounding = 4;
208 style.ScaleAllSizes(scaleFactor);
209
210 const ImVec4 color_Cardinal(0.76f, 0.11f, 0.22f, 1.f);
211 const ImVec4 color_DimCardinal(171.f / 255.f, 54.f / 255.f, 73.f / 255.f, 1.f);
212
213 ImVec4* const colors = style.Colors;
214 colors[ImGuiCol_Text] = ImVec4(1.f, 1.f, 1.f, 1.f);
215 colors[ImGuiCol_TextDisabled] = ImVec4(0.5f, 0.5f, 0.5f, 1.f);
216 colors[ImGuiCol_WindowBg] = ImVec4(0.099f, 0.099f, 0.099f, 1.f);
217 colors[ImGuiCol_FrameBg] = ImVec4(0.20f, 0.21f, 0.22f, 0.54f);
218 colors[ImGuiCol_FrameBgHovered] = ImVec4(0.40f, 0.40f, 0.40f, 0.40f);
219 colors[ImGuiCol_FrameBgActive] = ImVec4(0.18f, 0.18f, 0.18f, 0.67f);
220 colors[ImGuiCol_TitleBgActive] = ImVec4(0.29f, 0.29f, 0.29f, 1.00f);
221 colors[ImGuiCol_CheckMark] = color_Cardinal;
222 colors[ImGuiCol_SliderGrab] = color_DimCardinal;
223 colors[ImGuiCol_SliderGrabActive] = color_Cardinal;
224 colors[ImGuiCol_Button] = color_DimCardinal;
225 colors[ImGuiCol_ButtonHovered] = color_Cardinal;
226 colors[ImGuiCol_ButtonActive] = color_Cardinal;
227 colors[ImGuiCol_TextSelectedBg] = ImVec4(0.87f, 0.87f, 0.87f, 0.35f);
228 colors[ImGuiCol_Header] = ImVec4(0.44f, 0.44f, 0.44f, 0.4f);
229 colors[ImGuiCol_HeaderHovered] = color_DimCardinal;
230 colors[ImGuiCol_HeaderActive] = color_Cardinal;
231
232 if (!settings::preferDarkPanels)
233 {
234 for (int c = 0; c < ImGuiCol_COUNT; ++c)
235 {
236 if (std::memcmp(&colors[c], &color_Cardinal, sizeof(color_Cardinal)) == 0)
237 continue;
238 if (std::memcmp(&colors[c], &color_DimCardinal, sizeof(color_DimCardinal)) == 0)
239 continue;
240 colors[c] = ImVec4(1.f - colors[c].x, 1.f - colors[c].y, 1.f - colors[c].z, colors[c].w);
241 }
242 }
243 }
244};
245
246ImGuiWidget::ImGuiWidget()

Callers

nothing calls this directly

Calls 3

ImVec4Class · 0.85
memcmpFunction · 0.85
ScaleAllSizesMethod · 0.80

Tested by

no test coverage detected