119 ImGuiStyle *style = &ImGui::GetStyle();
120 ImVec4 *colors = style->Colors;
122 style->WindowPadding = ImVec2(10.f, 10.f);
123 style->FramePadding = ImVec2(10.f, 2.f);
124 style->CellPadding = ImVec2(4.f, 5.f);
125 style->ItemSpacing = ImVec2(10.f, 5.f);
126 style->ItemInnerSpacing = ImVec2(5.f, 5.f);
127 style->TouchExtraPadding = ImVec2(0.f, 0.f);
128 style->IndentSpacing = 20.f;
129 style->ScrollbarSize = 14.f;
130 style->GrabMinSize = 15.f;
132 style->WindowBorderSize = 0.f;
133 style->ChildBorderSize = 1.f;
134 style->PopupBorderSize = 1.f;
135 style->FrameBorderSize = 0.f;
136 style->TabBorderSize = 0.f;
138 style->WindowRounding = 0.f;
139 style->ChildRounding = 0.f;
140 style->FrameRounding = 5.f;
141 style->PopupRounding = 0.f;
142 style->ScrollbarRounding = 5.f;
144 auto alttpDarkGreen = ImVec4(0.18f, 0.26f, 0.18f, 1.0f);
145 auto alttpMidGreen = ImVec4(0.28f, 0.36f, 0.28f, 1.0f);
146 auto allttpLightGreen = ImVec4(0.36f, 0.45f, 0.36f, 1.0f);
147 auto allttpLightestGreen = ImVec4(0.49f, 0.57f, 0.49f, 1.0f);
149 colors[ImGuiCol_MenuBarBg] = alttpDarkGreen;
150 colors[ImGuiCol_TitleBg] = alttpMidGreen;
152 colors[ImGuiCol_Header] = alttpDarkGreen;
153 colors[ImGuiCol_HeaderHovered] = allttpLightGreen;
154 colors[ImGuiCol_HeaderActive] = alttpMidGreen;
156 colors[ImGuiCol_TitleBgActive] = alttpDarkGreen;
157 colors[ImGuiCol_TitleBgCollapsed] = alttpMidGreen;
159 colors[ImGuiCol_Tab] = alttpDarkGreen;
160 colors[ImGuiCol_TabHovered] = alttpMidGreen;
161 colors[ImGuiCol_TabActive] = ImVec4(0.347f, 0.466f, 0.347f, 1.000f);
163 colors[ImGuiCol_Button] = alttpMidGreen;
164 colors[ImGuiCol_ButtonHovered] = allttpLightestGreen;
165 colors[ImGuiCol_ButtonActive] = allttpLightGreen;
167 colors[ImGuiCol_ScrollbarBg] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
168 colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.36f, 0.45f, 0.36f, 0.30f);
169 colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.36f, 0.45f, 0.36f, 0.40f);
170 colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
172 colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
173 colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
174 colors[ImGuiCol_WindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.85f);
175 colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
176 colors[ImGuiCol_PopupBg] = ImVec4(0.11f, 0.11f, 0.14f, 0.92f);
177 colors[ImGuiCol_Border] = allttpLightGreen;
178 colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
180 colors[ImGuiCol_FrameBg] = ImVec4(0.43f, 0.43f, 0.43f, 0.39f);
181 colors[ImGuiCol_FrameBgHovered] = ImVec4(0.28f, 0.36f, 0.28f, 0.40f);
182 colors[ImGuiCol_FrameBgActive] = ImVec4(0.28f, 0.36f, 0.28f, 0.69f);
184 colors[ImGuiCol_CheckMark] = ImVec4(0.90f, 0.90f, 0.90f, 0.50f);
185 colors[ImGuiCol_SliderGrab] = ImVec4(1.00f, 1.00f, 1.00f, 0.30f);
186 colors[ImGuiCol_SliderGrabActive] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
188 colors[ImGuiCol_Separator] = ImVec4(0.50f, 0.50f, 0.50f, 0.60f);
189 colors[ImGuiCol_SeparatorHovered] = ImVec4(0.60f, 0.60f, 0.70f, 1.00f);
190 colors[ImGuiCol_SeparatorActive] = ImVec4(0.70f, 0.70f, 0.90f, 1.00f);
191 colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 0.10f);
192 colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.78f, 0.82f, 1.00f, 0.60f);
193 colors[ImGuiCol_ResizeGripActive] = ImVec4(0.78f, 0.82f, 1.00f, 0.90f);
195 colors[ImGuiCol_TabUnfocused] =
196 ImLerp(colors[ImGuiCol_Tab], colors[ImGuiCol_TitleBg], 0.80f);
197 colors[ImGuiCol_TabUnfocusedActive] =
198 ImLerp(colors[ImGuiCol_TabActive], colors[ImGuiCol_TitleBg], 0.40f);
199 colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
200 colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
201 colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
202 colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
203 colors[ImGuiCol_TableHeaderBg] = alttpDarkGreen;
204 colors[ImGuiCol_TableBorderStrong] = alttpMidGreen;
205 colors[ImGuiCol_TableBorderLight] =
206 ImVec4(0.26f, 0.26f, 0.28f, 1.00f);
207 colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
208 colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.07f);
209 colors[ImGuiCol_TextSelectedBg] = ImVec4(0.00f, 0.00f, 1.00f, 0.35f);
210 colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
211 colors[ImGuiCol_NavHighlight] = colors[ImGuiCol_HeaderHovered];
212 colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
213 colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
214 colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
387 ImGuiStyle &style = ImGui::GetStyle();
388 static ImGuiStyle ref_saved_style;
391 static bool init =
true;
392 if (init && ref == NULL)
393 ref_saved_style = style;
396 ref = &ref_saved_style;
398 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
400 if (ImGui::ShowStyleSelector(
"Colors##Selector"))
401 ref_saved_style = style;
402 ImGui::ShowFontSelector(
"Fonts##Selector");
406 if (ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
408 style.GrabRounding = style.FrameRounding;
411 bool border = (style.WindowBorderSize > 0.0f);
412 if (ImGui::Checkbox(
"WindowBorder", &border)) {
413 style.WindowBorderSize = border ? 1.0f : 0.0f;
418 bool border = (style.FrameBorderSize > 0.0f);
419 if (ImGui::Checkbox(
"FrameBorder", &border)) {
420 style.FrameBorderSize = border ? 1.0f : 0.0f;
425 bool border = (style.PopupBorderSize > 0.0f);
426 if (ImGui::Checkbox(
"PopupBorder", &border)) {
427 style.PopupBorderSize = border ? 1.0f : 0.0f;
432 if (ImGui::Button(
"Save Ref"))
433 *ref = ref_saved_style = style;
435 if (ImGui::Button(
"Revert Ref"))
441 if (ImGui::BeginTabBar(
"##tabs", ImGuiTabBarFlags_None)) {
442 if (ImGui::BeginTabItem(
"Sizes")) {
443 ImGui::SeparatorText(
"Main");
444 ImGui::SliderFloat2(
"WindowPadding", (
float *)&style.WindowPadding, 0.0f,
446 ImGui::SliderFloat2(
"FramePadding", (
float *)&style.FramePadding, 0.0f,
448 ImGui::SliderFloat2(
"ItemSpacing", (
float *)&style.ItemSpacing, 0.0f,
450 ImGui::SliderFloat2(
"ItemInnerSpacing", (
float *)&style.ItemInnerSpacing,
451 0.0f, 20.0f,
"%.0f");
452 ImGui::SliderFloat2(
"TouchExtraPadding",
453 (
float *)&style.TouchExtraPadding, 0.0f, 10.0f,
455 ImGui::SliderFloat(
"IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f,
457 ImGui::SliderFloat(
"ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f,
459 ImGui::SliderFloat(
"GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f,
462 ImGui::SeparatorText(
"Borders");
463 ImGui::SliderFloat(
"WindowBorderSize", &style.WindowBorderSize, 0.0f,
465 ImGui::SliderFloat(
"ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f,
467 ImGui::SliderFloat(
"PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f,
469 ImGui::SliderFloat(
"FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f,
471 ImGui::SliderFloat(
"TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f,
473 ImGui::SliderFloat(
"TabBarBorderSize", &style.TabBarBorderSize, 0.0f,
476 ImGui::SeparatorText(
"Rounding");
477 ImGui::SliderFloat(
"WindowRounding", &style.WindowRounding, 0.0f, 12.0f,
479 ImGui::SliderFloat(
"ChildRounding", &style.ChildRounding, 0.0f, 12.0f,
481 ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
483 ImGui::SliderFloat(
"PopupRounding", &style.PopupRounding, 0.0f, 12.0f,
485 ImGui::SliderFloat(
"ScrollbarRounding", &style.ScrollbarRounding, 0.0f,
487 ImGui::SliderFloat(
"GrabRounding", &style.GrabRounding, 0.0f, 12.0f,
489 ImGui::SliderFloat(
"TabRounding", &style.TabRounding, 0.0f, 12.0f,
492 ImGui::SeparatorText(
"Tables");
493 ImGui::SliderFloat2(
"CellPadding", (
float *)&style.CellPadding, 0.0f,
495 ImGui::SliderAngle(
"TableAngledHeadersAngle",
496 &style.TableAngledHeadersAngle, -50.0f, +50.0f);
498 ImGui::SeparatorText(
"Widgets");
499 ImGui::SliderFloat2(
"WindowTitleAlign", (
float *)&style.WindowTitleAlign,
501 ImGui::Combo(
"ColorButtonPosition", (
int *)&style.ColorButtonPosition,
503 ImGui::SliderFloat2(
"ButtonTextAlign", (
float *)&style.ButtonTextAlign,
507 ImGui::SliderFloat2(
"SelectableTextAlign",
508 (
float *)&style.SelectableTextAlign, 0.0f, 1.0f,
512 ImGui::SliderFloat(
"SeparatorTextBorderSize",
513 &style.SeparatorTextBorderSize, 0.0f, 10.0f,
"%.0f");
514 ImGui::SliderFloat2(
"SeparatorTextAlign",
515 (
float *)&style.SeparatorTextAlign, 0.0f, 1.0f,
517 ImGui::SliderFloat2(
"SeparatorTextPadding",
518 (
float *)&style.SeparatorTextPadding, 0.0f, 40.0f,
520 ImGui::SliderFloat(
"LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f,
523 ImGui::SeparatorText(
"Tooltips");
524 for (
int n = 0; n < 2; n++)
525 if (ImGui::TreeNodeEx(n == 0 ?
"HoverFlagsForTooltipMouse"
526 :
"HoverFlagsForTooltipNav")) {
527 ImGuiHoveredFlags *p = (n == 0) ? &style.HoverFlagsForTooltipMouse
528 : &style.HoverFlagsForTooltipNav;
529 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNone", p,
530 ImGuiHoveredFlags_DelayNone);
531 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayShort", p,
532 ImGuiHoveredFlags_DelayShort);
533 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNormal", p,
534 ImGuiHoveredFlags_DelayNormal);
535 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_Stationary", p,
536 ImGuiHoveredFlags_Stationary);
537 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_NoSharedDelay", p,
538 ImGuiHoveredFlags_NoSharedDelay);
542 ImGui::SeparatorText(
"Misc");
543 ImGui::SliderFloat2(
"DisplaySafeAreaPadding",
544 (
float *)&style.DisplaySafeAreaPadding, 0.0f, 30.0f,
551 if (ImGui::BeginTabItem(
"Colors")) {
552 static int output_dest = 0;
553 static bool output_only_modified =
true;
554 if (ImGui::Button(
"Export")) {
555 if (output_dest == 0)
556 ImGui::LogToClipboard();
559 ImGui::LogText(
"ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
560 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
561 const ImVec4 &col = style.Colors[i];
562 const char *name = ImGui::GetStyleColorName(i);
563 if (!output_only_modified ||
564 memcmp(&col, &ref->Colors[i],
sizeof(ImVec4)) != 0)
566 "colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, "
567 "%.2ff);" IM_NEWLINE,
568 name, 23 - (
int)strlen(name),
"", col.x, col.y, col.z, col.w);
573 ImGui::SetNextItemWidth(120);
574 ImGui::Combo(
"##output_type", &output_dest,
"To Clipboard\0To TTY\0");
576 ImGui::Checkbox(
"Only Modified Colors", &output_only_modified);
578 static ImGuiTextFilter filter;
579 filter.Draw(
"Filter colors", ImGui::GetFontSize() * 16);
581 static ImGuiColorEditFlags alpha_flags = 0;
582 if (ImGui::RadioButton(
"Opaque",
583 alpha_flags == ImGuiColorEditFlags_None)) {
584 alpha_flags = ImGuiColorEditFlags_None;
587 if (ImGui::RadioButton(
"Alpha",
588 alpha_flags == ImGuiColorEditFlags_AlphaPreview)) {
589 alpha_flags = ImGuiColorEditFlags_AlphaPreview;
592 if (ImGui::RadioButton(
593 "Both", alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) {
594 alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf;
598 ImGui::SetNextWindowSizeConstraints(
599 ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 10),
600 ImVec2(FLT_MAX, FLT_MAX));
601 ImGui::BeginChild(
"##colors", ImVec2(0, 0), ImGuiChildFlags_Border,
602 ImGuiWindowFlags_AlwaysVerticalScrollbar |
603 ImGuiWindowFlags_AlwaysHorizontalScrollbar |
604 ImGuiWindowFlags_NavFlattened);
605 ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
606 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
607 const char *name = ImGui::GetStyleColorName(i);
608 if (!filter.PassFilter(name))
611 ImGui::ColorEdit4(
"##color", (
float *)&style.Colors[i],
612 ImGuiColorEditFlags_AlphaBar | alpha_flags);
613 if (memcmp(&style.Colors[i], &ref->Colors[i],
sizeof(ImVec4)) != 0) {
618 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
619 if (ImGui::Button(
"Save")) {
620 ref->Colors[i] = style.Colors[i];
622 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
623 if (ImGui::Button(
"Revert")) {
624 style.Colors[i] = ref->Colors[i];
627 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
628 ImGui::TextUnformatted(name);
631 ImGui::PopItemWidth();
637 if (ImGui::BeginTabItem(
"Fonts")) {
638 ImGuiIO &io = ImGui::GetIO();
639 ImFontAtlas *atlas = io.Fonts;
640 ImGui::ShowFontAtlas(atlas);
646 const float MIN_SCALE = 0.3f;
647 const float MAX_SCALE = 2.0f;
649 static float window_scale = 1.0f;
650 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
651 if (ImGui::DragFloat(
652 "window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE,
654 ImGuiSliderFlags_AlwaysClamp))
655 ImGui::SetWindowFontScale(window_scale);
656 ImGui::DragFloat(
"global scale", &io.FontGlobalScale, 0.005f, MIN_SCALE,
658 ImGuiSliderFlags_AlwaysClamp);
659 ImGui::PopItemWidth();
664 if (ImGui::BeginTabItem(
"Rendering")) {
665 ImGui::Checkbox(
"Anti-aliased lines", &style.AntiAliasedLines);
668 ImGui::Checkbox(
"Anti-aliased lines use texture",
669 &style.AntiAliasedLinesUseTex);
672 ImGui::Checkbox(
"Anti-aliased fill", &style.AntiAliasedFill);
673 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
674 ImGui::DragFloat(
"Curve Tessellation Tolerance",
675 &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f,
677 if (style.CurveTessellationTol < 0.10f)
678 style.CurveTessellationTol = 0.10f;
682 ImGui::DragFloat(
"Circle Tessellation Max Error",
683 &style.CircleTessellationMaxError, 0.005f, 0.10f, 5.0f,
684 "%.2f", ImGuiSliderFlags_AlwaysClamp);
685 const bool show_samples = ImGui::IsItemActive();
687 ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
688 if (show_samples && ImGui::BeginTooltip()) {
689 ImGui::TextUnformatted(
"(R = radius, N = number of segments)");
691 ImDrawList *draw_list = ImGui::GetWindowDrawList();
692 const float min_widget_width = ImGui::CalcTextSize(
"N: MMM\nR: MMM").x;
693 for (
int n = 0; n < 8; n++) {
694 const float RAD_MIN = 5.0f;
695 const float RAD_MAX = 70.0f;
697 RAD_MIN + (RAD_MAX - RAD_MIN) * (
float)n / (8.0f - 1.0f);
701 ImGui::Text(
"R: %.f\nN: %d", rad,
702 draw_list->_CalcCircleAutoSegmentCount(rad));
704 const float canvas_width = std::max(min_widget_width, rad * 2.0f);
705 const float offset_x = floorf(canvas_width * 0.5f);
706 const float offset_y = floorf(RAD_MAX);
708 const ImVec2 p1 = ImGui::GetCursorScreenPos();
709 draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad,
710 ImGui::GetColorU32(ImGuiCol_Text));
711 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
727 ImGui::DragFloat(
"Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f,
732 ImGui::DragFloat(
"Disabled Alpha", &style.DisabledAlpha, 0.005f, 0.0f,
736 ImGui::PopItemWidth();
744 ImGui::PopItemWidth();