118 ImGuiStyle *style = &ImGui::GetStyle();
119 ImVec4 *colors = style->Colors;
121 style->WindowPadding = ImVec2(10.f, 10.f);
122 style->FramePadding = ImVec2(10.f, 2.f);
123 style->CellPadding = ImVec2(4.f, 5.f);
124 style->ItemSpacing = ImVec2(10.f, 5.f);
125 style->ItemInnerSpacing = ImVec2(5.f, 5.f);
126 style->TouchExtraPadding = ImVec2(0.f, 0.f);
127 style->IndentSpacing = 20.f;
128 style->ScrollbarSize = 14.f;
129 style->GrabMinSize = 15.f;
131 style->WindowBorderSize = 0.f;
132 style->ChildBorderSize = 1.f;
133 style->PopupBorderSize = 1.f;
134 style->FrameBorderSize = 0.f;
135 style->TabBorderSize = 0.f;
137 style->WindowRounding = 0.f;
138 style->ChildRounding = 0.f;
139 style->FrameRounding = 5.f;
140 style->PopupRounding = 0.f;
141 style->ScrollbarRounding = 5.f;
143 auto alttpDarkGreen = ImVec4(0.18f, 0.26f, 0.18f, 1.0f);
144 auto alttpMidGreen = ImVec4(0.28f, 0.36f, 0.28f, 1.0f);
145 auto allttpLightGreen = ImVec4(0.36f, 0.45f, 0.36f, 1.0f);
146 auto allttpLightestGreen = ImVec4(0.49f, 0.57f, 0.49f, 1.0f);
148 colors[ImGuiCol_MenuBarBg] = alttpDarkGreen;
149 colors[ImGuiCol_TitleBg] = alttpMidGreen;
151 colors[ImGuiCol_Header] = alttpDarkGreen;
152 colors[ImGuiCol_HeaderHovered] = allttpLightGreen;
153 colors[ImGuiCol_HeaderActive] = alttpMidGreen;
155 colors[ImGuiCol_TitleBgActive] = alttpDarkGreen;
156 colors[ImGuiCol_TitleBgCollapsed] = alttpMidGreen;
158 colors[ImGuiCol_Tab] = alttpDarkGreen;
159 colors[ImGuiCol_TabHovered] = alttpMidGreen;
160 colors[ImGuiCol_TabActive] = ImVec4(0.347f, 0.466f, 0.347f, 1.000f);
162 colors[ImGuiCol_Button] = alttpMidGreen;
163 colors[ImGuiCol_ButtonHovered] = allttpLightestGreen;
164 colors[ImGuiCol_ButtonActive] = allttpLightGreen;
166 colors[ImGuiCol_ScrollbarBg] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
167 colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.36f, 0.45f, 0.36f, 0.30f);
168 colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.36f, 0.45f, 0.36f, 0.40f);
169 colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
171 colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
172 colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
173 colors[ImGuiCol_WindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.85f);
174 colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
175 colors[ImGuiCol_PopupBg] = ImVec4(0.11f, 0.11f, 0.14f, 0.92f);
176 colors[ImGuiCol_Border] = allttpLightGreen;
177 colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
179 colors[ImGuiCol_FrameBg] = ImVec4(0.43f, 0.43f, 0.43f, 0.39f);
180 colors[ImGuiCol_FrameBgHovered] = ImVec4(0.28f, 0.36f, 0.28f, 0.40f);
181 colors[ImGuiCol_FrameBgActive] = ImVec4(0.28f, 0.36f, 0.28f, 0.69f);
183 colors[ImGuiCol_CheckMark] = ImVec4(0.90f, 0.90f, 0.90f, 0.50f);
184 colors[ImGuiCol_SliderGrab] = ImVec4(1.00f, 1.00f, 1.00f, 0.30f);
185 colors[ImGuiCol_SliderGrabActive] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
187 colors[ImGuiCol_Separator] = ImVec4(0.50f, 0.50f, 0.50f, 0.60f);
188 colors[ImGuiCol_SeparatorHovered] = ImVec4(0.60f, 0.60f, 0.70f, 1.00f);
189 colors[ImGuiCol_SeparatorActive] = ImVec4(0.70f, 0.70f, 0.90f, 1.00f);
190 colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 0.10f);
191 colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.78f, 0.82f, 1.00f, 0.60f);
192 colors[ImGuiCol_ResizeGripActive] = ImVec4(0.78f, 0.82f, 1.00f, 0.90f);
194 colors[ImGuiCol_TabUnfocused] =
195 ImLerp(colors[ImGuiCol_Tab], colors[ImGuiCol_TitleBg], 0.80f);
196 colors[ImGuiCol_TabUnfocusedActive] =
197 ImLerp(colors[ImGuiCol_TabActive], colors[ImGuiCol_TitleBg], 0.40f);
198 colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
199 colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
200 colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
201 colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
202 colors[ImGuiCol_TableHeaderBg] = alttpDarkGreen;
203 colors[ImGuiCol_TableBorderStrong] = alttpMidGreen;
204 colors[ImGuiCol_TableBorderLight] =
205 ImVec4(0.26f, 0.26f, 0.28f, 1.00f);
206 colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
207 colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.07f);
208 colors[ImGuiCol_TextSelectedBg] = ImVec4(0.00f, 0.00f, 1.00f, 0.35f);
209 colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
210 colors[ImGuiCol_NavHighlight] = colors[ImGuiCol_HeaderHovered];
211 colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
212 colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
213 colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
386 ImGuiStyle &style = ImGui::GetStyle();
387 static ImGuiStyle ref_saved_style;
390 static bool init =
true;
391 if (init && ref == NULL)
392 ref_saved_style = style;
395 ref = &ref_saved_style;
397 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
399 if (ImGui::ShowStyleSelector(
"Colors##Selector"))
400 ref_saved_style = style;
401 ImGui::ShowFontSelector(
"Fonts##Selector");
405 if (ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
407 style.GrabRounding = style.FrameRounding;
410 bool border = (style.WindowBorderSize > 0.0f);
411 if (ImGui::Checkbox(
"WindowBorder", &border)) {
412 style.WindowBorderSize = border ? 1.0f : 0.0f;
417 bool border = (style.FrameBorderSize > 0.0f);
418 if (ImGui::Checkbox(
"FrameBorder", &border)) {
419 style.FrameBorderSize = border ? 1.0f : 0.0f;
424 bool border = (style.PopupBorderSize > 0.0f);
425 if (ImGui::Checkbox(
"PopupBorder", &border)) {
426 style.PopupBorderSize = border ? 1.0f : 0.0f;
431 if (ImGui::Button(
"Save Ref"))
432 *ref = ref_saved_style = style;
434 if (ImGui::Button(
"Revert Ref"))
440 if (ImGui::BeginTabBar(
"##tabs", ImGuiTabBarFlags_None)) {
441 if (ImGui::BeginTabItem(
"Sizes")) {
442 ImGui::SeparatorText(
"Main");
443 ImGui::SliderFloat2(
"WindowPadding", (
float *)&style.WindowPadding, 0.0f,
445 ImGui::SliderFloat2(
"FramePadding", (
float *)&style.FramePadding, 0.0f,
447 ImGui::SliderFloat2(
"ItemSpacing", (
float *)&style.ItemSpacing, 0.0f,
449 ImGui::SliderFloat2(
"ItemInnerSpacing", (
float *)&style.ItemInnerSpacing,
450 0.0f, 20.0f,
"%.0f");
451 ImGui::SliderFloat2(
"TouchExtraPadding",
452 (
float *)&style.TouchExtraPadding, 0.0f, 10.0f,
454 ImGui::SliderFloat(
"IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f,
456 ImGui::SliderFloat(
"ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f,
458 ImGui::SliderFloat(
"GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f,
461 ImGui::SeparatorText(
"Borders");
462 ImGui::SliderFloat(
"WindowBorderSize", &style.WindowBorderSize, 0.0f,
464 ImGui::SliderFloat(
"ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f,
466 ImGui::SliderFloat(
"PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f,
468 ImGui::SliderFloat(
"FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f,
470 ImGui::SliderFloat(
"TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f,
472 ImGui::SliderFloat(
"TabBarBorderSize", &style.TabBarBorderSize, 0.0f,
475 ImGui::SeparatorText(
"Rounding");
476 ImGui::SliderFloat(
"WindowRounding", &style.WindowRounding, 0.0f, 12.0f,
478 ImGui::SliderFloat(
"ChildRounding", &style.ChildRounding, 0.0f, 12.0f,
480 ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
482 ImGui::SliderFloat(
"PopupRounding", &style.PopupRounding, 0.0f, 12.0f,
484 ImGui::SliderFloat(
"ScrollbarRounding", &style.ScrollbarRounding, 0.0f,
486 ImGui::SliderFloat(
"GrabRounding", &style.GrabRounding, 0.0f, 12.0f,
488 ImGui::SliderFloat(
"TabRounding", &style.TabRounding, 0.0f, 12.0f,
491 ImGui::SeparatorText(
"Tables");
492 ImGui::SliderFloat2(
"CellPadding", (
float *)&style.CellPadding, 0.0f,
494 ImGui::SliderAngle(
"TableAngledHeadersAngle",
495 &style.TableAngledHeadersAngle, -50.0f, +50.0f);
497 ImGui::SeparatorText(
"Widgets");
498 ImGui::SliderFloat2(
"WindowTitleAlign", (
float *)&style.WindowTitleAlign,
500 ImGui::Combo(
"ColorButtonPosition", (
int *)&style.ColorButtonPosition,
502 ImGui::SliderFloat2(
"ButtonTextAlign", (
float *)&style.ButtonTextAlign,
506 ImGui::SliderFloat2(
"SelectableTextAlign",
507 (
float *)&style.SelectableTextAlign, 0.0f, 1.0f,
511 ImGui::SliderFloat(
"SeparatorTextBorderSize",
512 &style.SeparatorTextBorderSize, 0.0f, 10.0f,
"%.0f");
513 ImGui::SliderFloat2(
"SeparatorTextAlign",
514 (
float *)&style.SeparatorTextAlign, 0.0f, 1.0f,
516 ImGui::SliderFloat2(
"SeparatorTextPadding",
517 (
float *)&style.SeparatorTextPadding, 0.0f, 40.0f,
519 ImGui::SliderFloat(
"LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f,
522 ImGui::SeparatorText(
"Tooltips");
523 for (
int n = 0; n < 2; n++)
524 if (ImGui::TreeNodeEx(n == 0 ?
"HoverFlagsForTooltipMouse"
525 :
"HoverFlagsForTooltipNav")) {
526 ImGuiHoveredFlags *p = (n == 0) ? &style.HoverFlagsForTooltipMouse
527 : &style.HoverFlagsForTooltipNav;
528 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNone", p,
529 ImGuiHoveredFlags_DelayNone);
530 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayShort", p,
531 ImGuiHoveredFlags_DelayShort);
532 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNormal", p,
533 ImGuiHoveredFlags_DelayNormal);
534 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_Stationary", p,
535 ImGuiHoveredFlags_Stationary);
536 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_NoSharedDelay", p,
537 ImGuiHoveredFlags_NoSharedDelay);
541 ImGui::SeparatorText(
"Misc");
542 ImGui::SliderFloat2(
"DisplaySafeAreaPadding",
543 (
float *)&style.DisplaySafeAreaPadding, 0.0f, 30.0f,
550 if (ImGui::BeginTabItem(
"Colors")) {
551 static int output_dest = 0;
552 static bool output_only_modified =
true;
553 if (ImGui::Button(
"Export")) {
554 if (output_dest == 0)
555 ImGui::LogToClipboard();
558 ImGui::LogText(
"ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
559 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
560 const ImVec4 &col = style.Colors[i];
561 const char *name = ImGui::GetStyleColorName(i);
562 if (!output_only_modified ||
563 memcmp(&col, &ref->Colors[i],
sizeof(ImVec4)) != 0)
565 "colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, "
566 "%.2ff);" IM_NEWLINE,
567 name, 23 - (
int)strlen(name),
"", col.x, col.y, col.z, col.w);
572 ImGui::SetNextItemWidth(120);
573 ImGui::Combo(
"##output_type", &output_dest,
"To Clipboard\0To TTY\0");
575 ImGui::Checkbox(
"Only Modified Colors", &output_only_modified);
577 static ImGuiTextFilter filter;
578 filter.Draw(
"Filter colors", ImGui::GetFontSize() * 16);
580 static ImGuiColorEditFlags alpha_flags = 0;
581 if (ImGui::RadioButton(
"Opaque",
582 alpha_flags == ImGuiColorEditFlags_None)) {
583 alpha_flags = ImGuiColorEditFlags_None;
586 if (ImGui::RadioButton(
"Alpha",
587 alpha_flags == ImGuiColorEditFlags_AlphaPreview)) {
588 alpha_flags = ImGuiColorEditFlags_AlphaPreview;
591 if (ImGui::RadioButton(
592 "Both", alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) {
593 alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf;
597 ImGui::SetNextWindowSizeConstraints(
598 ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 10),
599 ImVec2(FLT_MAX, FLT_MAX));
600 ImGui::BeginChild(
"##colors", ImVec2(0, 0), ImGuiChildFlags_Border,
601 ImGuiWindowFlags_AlwaysVerticalScrollbar |
602 ImGuiWindowFlags_AlwaysHorizontalScrollbar |
603 ImGuiWindowFlags_NavFlattened);
604 ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
605 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
606 const char *name = ImGui::GetStyleColorName(i);
607 if (!filter.PassFilter(name))
610 ImGui::ColorEdit4(
"##color", (
float *)&style.Colors[i],
611 ImGuiColorEditFlags_AlphaBar | alpha_flags);
612 if (memcmp(&style.Colors[i], &ref->Colors[i],
sizeof(ImVec4)) != 0) {
617 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
618 if (ImGui::Button(
"Save")) {
619 ref->Colors[i] = style.Colors[i];
621 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
622 if (ImGui::Button(
"Revert")) {
623 style.Colors[i] = ref->Colors[i];
626 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
627 ImGui::TextUnformatted(name);
630 ImGui::PopItemWidth();
636 if (ImGui::BeginTabItem(
"Fonts")) {
637 ImGuiIO &io = ImGui::GetIO();
638 ImFontAtlas *atlas = io.Fonts;
639 ImGui::ShowFontAtlas(atlas);
645 const float MIN_SCALE = 0.3f;
646 const float MAX_SCALE = 2.0f;
648 static float window_scale = 1.0f;
649 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
650 if (ImGui::DragFloat(
651 "window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE,
653 ImGuiSliderFlags_AlwaysClamp))
654 ImGui::SetWindowFontScale(window_scale);
655 ImGui::DragFloat(
"global scale", &io.FontGlobalScale, 0.005f, MIN_SCALE,
657 ImGuiSliderFlags_AlwaysClamp);
658 ImGui::PopItemWidth();
663 if (ImGui::BeginTabItem(
"Rendering")) {
664 ImGui::Checkbox(
"Anti-aliased lines", &style.AntiAliasedLines);
667 ImGui::Checkbox(
"Anti-aliased lines use texture",
668 &style.AntiAliasedLinesUseTex);
671 ImGui::Checkbox(
"Anti-aliased fill", &style.AntiAliasedFill);
672 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
673 ImGui::DragFloat(
"Curve Tessellation Tolerance",
674 &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f,
676 if (style.CurveTessellationTol < 0.10f)
677 style.CurveTessellationTol = 0.10f;
681 ImGui::DragFloat(
"Circle Tessellation Max Error",
682 &style.CircleTessellationMaxError, 0.005f, 0.10f, 5.0f,
683 "%.2f", ImGuiSliderFlags_AlwaysClamp);
684 const bool show_samples = ImGui::IsItemActive();
686 ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
687 if (show_samples && ImGui::BeginTooltip()) {
688 ImGui::TextUnformatted(
"(R = radius, N = number of segments)");
690 ImDrawList *draw_list = ImGui::GetWindowDrawList();
691 const float min_widget_width = ImGui::CalcTextSize(
"N: MMM\nR: MMM").x;
692 for (
int n = 0; n < 8; n++) {
693 const float RAD_MIN = 5.0f;
694 const float RAD_MAX = 70.0f;
696 RAD_MIN + (RAD_MAX - RAD_MIN) * (
float)n / (8.0f - 1.0f);
700 ImGui::Text(
"R: %.f\nN: %d", rad,
701 draw_list->_CalcCircleAutoSegmentCount(rad));
703 const float canvas_width = std::max(min_widget_width, rad * 2.0f);
704 const float offset_x = floorf(canvas_width * 0.5f);
705 const float offset_y = floorf(RAD_MAX);
707 const ImVec2 p1 = ImGui::GetCursorScreenPos();
708 draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad,
709 ImGui::GetColorU32(ImGuiCol_Text));
710 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
726 ImGui::DragFloat(
"Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f,
731 ImGui::DragFloat(
"Disabled Alpha", &style.DisabledAlpha, 0.005f, 0.0f,
735 ImGui::PopItemWidth();
743 ImGui::PopItemWidth();