133 ImGuiStyle *style = &ImGui::GetStyle();
134 ImVec4 *colors = style->Colors;
136 style->WindowPadding = ImVec2(10.f, 10.f);
137 style->FramePadding = ImVec2(10.f, 2.f);
138 style->CellPadding = ImVec2(4.f, 5.f);
139 style->ItemSpacing = ImVec2(10.f, 5.f);
140 style->ItemInnerSpacing = ImVec2(5.f, 5.f);
141 style->TouchExtraPadding = ImVec2(0.f, 0.f);
142 style->IndentSpacing = 20.f;
143 style->ScrollbarSize = 14.f;
144 style->GrabMinSize = 15.f;
146 style->WindowBorderSize = 0.f;
147 style->ChildBorderSize = 1.f;
148 style->PopupBorderSize = 1.f;
149 style->FrameBorderSize = 0.f;
150 style->TabBorderSize = 0.f;
152 style->WindowRounding = 0.f;
153 style->ChildRounding = 0.f;
154 style->FrameRounding = 5.f;
155 style->PopupRounding = 0.f;
156 style->ScrollbarRounding = 5.f;
158 auto alttpDarkGreen = ImVec4(0.18f, 0.26f, 0.18f, 1.0f);
159 auto alttpMidGreen = ImVec4(0.28f, 0.36f, 0.28f, 1.0f);
160 auto allttpLightGreen = ImVec4(0.36f, 0.45f, 0.36f, 1.0f);
161 auto allttpLightestGreen = ImVec4(0.49f, 0.57f, 0.49f, 1.0f);
163 colors[ImGuiCol_MenuBarBg] = alttpDarkGreen;
164 colors[ImGuiCol_TitleBg] = alttpMidGreen;
166 colors[ImGuiCol_Header] = alttpDarkGreen;
167 colors[ImGuiCol_HeaderHovered] = allttpLightGreen;
168 colors[ImGuiCol_HeaderActive] = alttpMidGreen;
170 colors[ImGuiCol_TitleBgActive] = alttpDarkGreen;
171 colors[ImGuiCol_TitleBgCollapsed] = alttpMidGreen;
173 colors[ImGuiCol_Tab] = alttpDarkGreen;
174 colors[ImGuiCol_TabHovered] = alttpMidGreen;
175 colors[ImGuiCol_TabActive] = ImVec4(0.347f, 0.466f, 0.347f, 1.000f);
177 colors[ImGuiCol_Button] = alttpMidGreen;
178 colors[ImGuiCol_ButtonHovered] = allttpLightestGreen;
179 colors[ImGuiCol_ButtonActive] = allttpLightGreen;
181 colors[ImGuiCol_ScrollbarBg] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
182 colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.36f, 0.45f, 0.36f, 0.30f);
183 colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.36f, 0.45f, 0.36f, 0.40f);
184 colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
186 colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
187 colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
188 colors[ImGuiCol_WindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.85f);
189 colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
190 colors[ImGuiCol_PopupBg] = ImVec4(0.11f, 0.11f, 0.14f, 0.92f);
191 colors[ImGuiCol_Border] = allttpLightGreen;
192 colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
194 colors[ImGuiCol_FrameBg] = ImVec4(0.43f, 0.43f, 0.43f, 0.39f);
195 colors[ImGuiCol_FrameBgHovered] = ImVec4(0.28f, 0.36f, 0.28f, 0.40f);
196 colors[ImGuiCol_FrameBgActive] = ImVec4(0.28f, 0.36f, 0.28f, 0.69f);
198 colors[ImGuiCol_CheckMark] = ImVec4(0.90f, 0.90f, 0.90f, 0.50f);
199 colors[ImGuiCol_SliderGrab] = ImVec4(1.00f, 1.00f, 1.00f, 0.30f);
200 colors[ImGuiCol_SliderGrabActive] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
202 colors[ImGuiCol_Separator] = ImVec4(0.50f, 0.50f, 0.50f, 0.60f);
203 colors[ImGuiCol_SeparatorHovered] = ImVec4(0.60f, 0.60f, 0.70f, 1.00f);
204 colors[ImGuiCol_SeparatorActive] = ImVec4(0.70f, 0.70f, 0.90f, 1.00f);
205 colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 0.10f);
206 colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.78f, 0.82f, 1.00f, 0.60f);
207 colors[ImGuiCol_ResizeGripActive] = ImVec4(0.78f, 0.82f, 1.00f, 0.90f);
209 colors[ImGuiCol_TabUnfocused] =
210 ImLerp(colors[ImGuiCol_Tab], colors[ImGuiCol_TitleBg], 0.80f);
211 colors[ImGuiCol_TabUnfocusedActive] =
212 ImLerp(colors[ImGuiCol_TabActive], colors[ImGuiCol_TitleBg], 0.40f);
213 colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
214 colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
215 colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
216 colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
217 colors[ImGuiCol_TableHeaderBg] = alttpDarkGreen;
218 colors[ImGuiCol_TableBorderStrong] = alttpMidGreen;
219 colors[ImGuiCol_TableBorderLight] =
220 ImVec4(0.26f, 0.26f, 0.28f, 1.00f);
221 colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
222 colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.07f);
223 colors[ImGuiCol_TextSelectedBg] = ImVec4(0.00f, 0.00f, 1.00f, 0.35f);
224 colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
225 colors[ImGuiCol_NavHighlight] = colors[ImGuiCol_HeaderHovered];
226 colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
227 colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
228 colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
400 ImGuiStyle &style = ImGui::GetStyle();
401 static ImGuiStyle ref_saved_style;
404 static bool init =
true;
405 if (init && ref == NULL) ref_saved_style = style;
407 if (ref == NULL) ref = &ref_saved_style;
409 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
411 if (ImGui::ShowStyleSelector(
"Colors##Selector")) ref_saved_style = style;
412 ImGui::ShowFontSelector(
"Fonts##Selector");
416 if (ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
418 style.GrabRounding = style.FrameRounding;
421 bool border = (style.WindowBorderSize > 0.0f);
422 if (ImGui::Checkbox(
"WindowBorder", &border)) {
423 style.WindowBorderSize = border ? 1.0f : 0.0f;
428 bool border = (style.FrameBorderSize > 0.0f);
429 if (ImGui::Checkbox(
"FrameBorder", &border)) {
430 style.FrameBorderSize = border ? 1.0f : 0.0f;
435 bool border = (style.PopupBorderSize > 0.0f);
436 if (ImGui::Checkbox(
"PopupBorder", &border)) {
437 style.PopupBorderSize = border ? 1.0f : 0.0f;
442 if (ImGui::Button(
"Save Ref")) *ref = ref_saved_style = style;
444 if (ImGui::Button(
"Revert Ref")) style = *ref;
449 if (ImGui::BeginTabBar(
"##tabs", ImGuiTabBarFlags_None)) {
450 if (ImGui::BeginTabItem(
"Sizes")) {
451 ImGui::SeparatorText(
"Main");
452 ImGui::SliderFloat2(
"WindowPadding", (
float *)&style.WindowPadding, 0.0f,
454 ImGui::SliderFloat2(
"FramePadding", (
float *)&style.FramePadding, 0.0f,
456 ImGui::SliderFloat2(
"ItemSpacing", (
float *)&style.ItemSpacing, 0.0f,
458 ImGui::SliderFloat2(
"ItemInnerSpacing", (
float *)&style.ItemInnerSpacing,
459 0.0f, 20.0f,
"%.0f");
460 ImGui::SliderFloat2(
"TouchExtraPadding",
461 (
float *)&style.TouchExtraPadding, 0.0f, 10.0f,
463 ImGui::SliderFloat(
"IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f,
465 ImGui::SliderFloat(
"ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f,
467 ImGui::SliderFloat(
"GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f,
470 ImGui::SeparatorText(
"Borders");
471 ImGui::SliderFloat(
"WindowBorderSize", &style.WindowBorderSize, 0.0f,
473 ImGui::SliderFloat(
"ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f,
475 ImGui::SliderFloat(
"PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f,
477 ImGui::SliderFloat(
"FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f,
479 ImGui::SliderFloat(
"TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f,
481 ImGui::SliderFloat(
"TabBarBorderSize", &style.TabBarBorderSize, 0.0f,
484 ImGui::SeparatorText(
"Rounding");
485 ImGui::SliderFloat(
"WindowRounding", &style.WindowRounding, 0.0f, 12.0f,
487 ImGui::SliderFloat(
"ChildRounding", &style.ChildRounding, 0.0f, 12.0f,
489 ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
491 ImGui::SliderFloat(
"PopupRounding", &style.PopupRounding, 0.0f, 12.0f,
493 ImGui::SliderFloat(
"ScrollbarRounding", &style.ScrollbarRounding, 0.0f,
495 ImGui::SliderFloat(
"GrabRounding", &style.GrabRounding, 0.0f, 12.0f,
497 ImGui::SliderFloat(
"TabRounding", &style.TabRounding, 0.0f, 12.0f,
500 ImGui::SeparatorText(
"Tables");
501 ImGui::SliderFloat2(
"CellPadding", (
float *)&style.CellPadding, 0.0f,
503 ImGui::SliderAngle(
"TableAngledHeadersAngle",
504 &style.TableAngledHeadersAngle, -50.0f, +50.0f);
506 ImGui::SeparatorText(
"Widgets");
507 ImGui::SliderFloat2(
"WindowTitleAlign", (
float *)&style.WindowTitleAlign,
509 ImGui::Combo(
"ColorButtonPosition", (
int *)&style.ColorButtonPosition,
511 ImGui::SliderFloat2(
"ButtonTextAlign", (
float *)&style.ButtonTextAlign,
515 ImGui::SliderFloat2(
"SelectableTextAlign",
516 (
float *)&style.SelectableTextAlign, 0.0f, 1.0f,
520 ImGui::SliderFloat(
"SeparatorTextBorderSize",
521 &style.SeparatorTextBorderSize, 0.0f, 10.0f,
"%.0f");
522 ImGui::SliderFloat2(
"SeparatorTextAlign",
523 (
float *)&style.SeparatorTextAlign, 0.0f, 1.0f,
525 ImGui::SliderFloat2(
"SeparatorTextPadding",
526 (
float *)&style.SeparatorTextPadding, 0.0f, 40.0f,
528 ImGui::SliderFloat(
"LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f,
531 ImGui::SeparatorText(
"Tooltips");
532 for (
int n = 0; n < 2; n++)
533 if (ImGui::TreeNodeEx(n == 0 ?
"HoverFlagsForTooltipMouse"
534 :
"HoverFlagsForTooltipNav")) {
535 ImGuiHoveredFlags *p = (n == 0) ? &style.HoverFlagsForTooltipMouse
536 : &style.HoverFlagsForTooltipNav;
537 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNone", p,
538 ImGuiHoveredFlags_DelayNone);
539 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayShort", p,
540 ImGuiHoveredFlags_DelayShort);
541 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNormal", p,
542 ImGuiHoveredFlags_DelayNormal);
543 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_Stationary", p,
544 ImGuiHoveredFlags_Stationary);
545 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_NoSharedDelay", p,
546 ImGuiHoveredFlags_NoSharedDelay);
550 ImGui::SeparatorText(
"Misc");
551 ImGui::SliderFloat2(
"DisplaySafeAreaPadding",
552 (
float *)&style.DisplaySafeAreaPadding, 0.0f, 30.0f,
559 if (ImGui::BeginTabItem(
"Colors")) {
560 static int output_dest = 0;
561 static bool output_only_modified =
true;
562 if (ImGui::Button(
"Export")) {
563 if (output_dest == 0)
564 ImGui::LogToClipboard();
567 ImGui::LogText(
"ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
568 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
569 const ImVec4 &col = style.Colors[i];
570 const char *name = ImGui::GetStyleColorName(i);
571 if (!output_only_modified ||
572 memcmp(&col, &ref->Colors[i],
sizeof(ImVec4)) != 0)
574 "colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, "
575 "%.2ff);" IM_NEWLINE,
576 name, 23 - (
int)strlen(name),
"", col.x, col.y, col.z, col.w);
581 ImGui::SetNextItemWidth(120);
582 ImGui::Combo(
"##output_type", &output_dest,
"To Clipboard\0To TTY\0");
584 ImGui::Checkbox(
"Only Modified Colors", &output_only_modified);
586 static ImGuiTextFilter filter;
587 filter.Draw(
"Filter colors", ImGui::GetFontSize() * 16);
589 static ImGuiColorEditFlags alpha_flags = 0;
590 if (ImGui::RadioButton(
"Opaque",
591 alpha_flags == ImGuiColorEditFlags_None)) {
592 alpha_flags = ImGuiColorEditFlags_None;
595 if (ImGui::RadioButton(
"Alpha",
596 alpha_flags == ImGuiColorEditFlags_AlphaPreview)) {
597 alpha_flags = ImGuiColorEditFlags_AlphaPreview;
600 if (ImGui::RadioButton(
601 "Both", alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) {
602 alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf;
606 ImGui::SetNextWindowSizeConstraints(
607 ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 10),
608 ImVec2(FLT_MAX, FLT_MAX));
609 ImGui::BeginChild(
"##colors", ImVec2(0, 0), ImGuiChildFlags_Border,
610 ImGuiWindowFlags_AlwaysVerticalScrollbar |
611 ImGuiWindowFlags_AlwaysHorizontalScrollbar |
612 ImGuiWindowFlags_NavFlattened);
613 ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
614 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
615 const char *name = ImGui::GetStyleColorName(i);
616 if (!filter.PassFilter(name))
continue;
618 ImGui::ColorEdit4(
"##color", (
float *)&style.Colors[i],
619 ImGuiColorEditFlags_AlphaBar | alpha_flags);
620 if (memcmp(&style.Colors[i], &ref->Colors[i],
sizeof(ImVec4)) != 0) {
625 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
626 if (ImGui::Button(
"Save")) {
627 ref->Colors[i] = style.Colors[i];
629 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
630 if (ImGui::Button(
"Revert")) {
631 style.Colors[i] = ref->Colors[i];
634 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
635 ImGui::TextUnformatted(name);
638 ImGui::PopItemWidth();
644 if (ImGui::BeginTabItem(
"Fonts")) {
645 ImGuiIO &io = ImGui::GetIO();
646 ImFontAtlas *atlas = io.Fonts;
647 ImGui::ShowFontAtlas(atlas);
653 const float MIN_SCALE = 0.3f;
654 const float MAX_SCALE = 2.0f;
656 static float window_scale = 1.0f;
657 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
658 if (ImGui::DragFloat(
659 "window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE,
661 ImGuiSliderFlags_AlwaysClamp))
662 ImGui::SetWindowFontScale(window_scale);
663 ImGui::DragFloat(
"global scale", &io.FontGlobalScale, 0.005f, MIN_SCALE,
665 ImGuiSliderFlags_AlwaysClamp);
666 ImGui::PopItemWidth();
671 if (ImGui::BeginTabItem(
"Rendering")) {
672 ImGui::Checkbox(
"Anti-aliased lines", &style.AntiAliasedLines);
675 ImGui::Checkbox(
"Anti-aliased lines use texture",
676 &style.AntiAliasedLinesUseTex);
679 ImGui::Checkbox(
"Anti-aliased fill", &style.AntiAliasedFill);
680 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
681 ImGui::DragFloat(
"Curve Tessellation Tolerance",
682 &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f,
684 if (style.CurveTessellationTol < 0.10f)
685 style.CurveTessellationTol = 0.10f;
689 ImGui::DragFloat(
"Circle Tessellation Max Error",
690 &style.CircleTessellationMaxError, 0.005f, 0.10f, 5.0f,
691 "%.2f", ImGuiSliderFlags_AlwaysClamp);
692 const bool show_samples = ImGui::IsItemActive();
693 if (show_samples) ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
694 if (show_samples && ImGui::BeginTooltip()) {
695 ImGui::TextUnformatted(
"(R = radius, N = number of segments)");
697 ImDrawList *draw_list = ImGui::GetWindowDrawList();
698 const float min_widget_width = ImGui::CalcTextSize(
"N: MMM\nR: MMM").x;
699 for (
int n = 0; n < 8; n++) {
700 const float RAD_MIN = 5.0f;
701 const float RAD_MAX = 70.0f;
703 RAD_MIN + (RAD_MAX - RAD_MIN) * (
float)n / (8.0f - 1.0f);
707 ImGui::Text(
"R: %.f\nN: %d", rad,
708 draw_list->_CalcCircleAutoSegmentCount(rad));
710 const float canvas_width = std::max(min_widget_width, rad * 2.0f);
711 const float offset_x = floorf(canvas_width * 0.5f);
712 const float offset_y = floorf(RAD_MAX);
714 const ImVec2 p1 = ImGui::GetCursorScreenPos();
715 draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad,
716 ImGui::GetColorU32(ImGuiCol_Text));
717 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
733 ImGui::DragFloat(
"Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f,
738 ImGui::DragFloat(
"Disabled Alpha", &style.DisabledAlpha, 0.005f, 0.0f,
742 ImGui::PopItemWidth();
750 ImGui::PopItemWidth();