34 ImGuiStyle* style = &ImGui::GetStyle();
35 ImVec4* colors = style->Colors;
37 style->WindowPadding = ImVec2(10.f, 10.f);
38 style->FramePadding = ImVec2(10.f, 2.f);
39 style->CellPadding = ImVec2(4.f, 5.f);
40 style->ItemSpacing = ImVec2(10.f, 5.f);
41 style->ItemInnerSpacing = ImVec2(5.f, 5.f);
42 style->TouchExtraPadding = ImVec2(0.f, 0.f);
43 style->IndentSpacing = 20.f;
44 style->ScrollbarSize = 14.f;
45 style->GrabMinSize = 15.f;
47 style->WindowBorderSize = 0.f;
48 style->ChildBorderSize = 1.f;
49 style->PopupBorderSize = 1.f;
50 style->FrameBorderSize = 0.f;
51 style->TabBorderSize = 0.f;
53 style->WindowRounding = 0.f;
54 style->ChildRounding = 0.f;
55 style->FrameRounding = 5.f;
56 style->PopupRounding = 0.f;
57 style->ScrollbarRounding = 5.f;
59 auto alttpDarkGreen = ImVec4(0.18f, 0.26f, 0.18f, 1.0f);
60 auto alttpMidGreen = ImVec4(0.28f, 0.36f, 0.28f, 1.0f);
61 auto allttpLightGreen = ImVec4(0.36f, 0.45f, 0.36f, 1.0f);
62 auto allttpLightestGreen = ImVec4(0.49f, 0.57f, 0.49f, 1.0f);
64 colors[ImGuiCol_MenuBarBg] = alttpDarkGreen;
65 colors[ImGuiCol_TitleBg] = alttpMidGreen;
67 colors[ImGuiCol_Header] = alttpDarkGreen;
68 colors[ImGuiCol_HeaderHovered] = allttpLightGreen;
69 colors[ImGuiCol_HeaderActive] = alttpMidGreen;
71 colors[ImGuiCol_TitleBgActive] = alttpDarkGreen;
72 colors[ImGuiCol_TitleBgCollapsed] = alttpMidGreen;
74 colors[ImGuiCol_Tab] = alttpDarkGreen;
75 colors[ImGuiCol_TabHovered] = alttpMidGreen;
76 colors[ImGuiCol_TabActive] = ImVec4(0.347f, 0.466f, 0.347f, 1.000f);
78 colors[ImGuiCol_Button] = alttpMidGreen;
79 colors[ImGuiCol_ButtonHovered] = allttpLightestGreen;
80 colors[ImGuiCol_ButtonActive] = allttpLightGreen;
82 colors[ImGuiCol_ScrollbarBg] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
83 colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.36f, 0.45f, 0.36f, 0.30f);
84 colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.36f, 0.45f, 0.36f, 0.40f);
85 colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
87 colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
88 colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
89 colors[ImGuiCol_WindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.85f);
90 colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
91 colors[ImGuiCol_PopupBg] = ImVec4(0.11f, 0.11f, 0.14f, 0.92f);
92 colors[ImGuiCol_Border] = allttpLightGreen;
93 colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
95 colors[ImGuiCol_FrameBg] = ImVec4(0.43f, 0.43f, 0.43f, 0.39f);
96 colors[ImGuiCol_FrameBgHovered] = ImVec4(0.28f, 0.36f, 0.28f, 0.40f);
97 colors[ImGuiCol_FrameBgActive] = ImVec4(0.28f, 0.36f, 0.28f, 0.69f);
99 colors[ImGuiCol_CheckMark] =
100 ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
101 colors[ImGuiCol_SliderGrab] = ImVec4(1.00f, 1.00f, 1.00f, 0.30f);
102 colors[ImGuiCol_SliderGrabActive] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
104 colors[ImGuiCol_Separator] = ImVec4(0.50f, 0.50f, 0.50f, 0.60f);
105 colors[ImGuiCol_SeparatorHovered] = ImVec4(0.60f, 0.60f, 0.70f, 1.00f);
106 colors[ImGuiCol_SeparatorActive] = ImVec4(0.70f, 0.70f, 0.90f, 1.00f);
107 colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 0.10f);
108 colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.78f, 0.82f, 1.00f, 0.60f);
109 colors[ImGuiCol_ResizeGripActive] = ImVec4(0.78f, 0.82f, 1.00f, 0.90f);
111 colors[ImGuiCol_TabUnfocused] =
112 ImLerp(colors[ImGuiCol_Tab], colors[ImGuiCol_TitleBg], 0.80f);
113 colors[ImGuiCol_TabUnfocusedActive] =
114 ImLerp(colors[ImGuiCol_TabActive], colors[ImGuiCol_TitleBg], 0.40f);
115 colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
116 colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
117 colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
118 colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
119 colors[ImGuiCol_TableHeaderBg] = alttpDarkGreen;
120 colors[ImGuiCol_TableBorderStrong] = alttpMidGreen;
121 colors[ImGuiCol_TableBorderLight] =
122 ImVec4(0.26f, 0.26f, 0.28f, 1.00f);
123 colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
124 colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.07f);
125 colors[ImGuiCol_TextSelectedBg] = ImVec4(0.00f, 0.00f, 1.00f, 0.35f);
126 colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
127 colors[ImGuiCol_NavHighlight] = colors[ImGuiCol_HeaderHovered];
128 colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
129 colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
130 colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
384 ImGuiStyle& style = ImGui::GetStyle();
385 static ImGuiStyle ref_saved_style;
388 static bool init =
true;
389 if (init && ref == NULL)
390 ref_saved_style = style;
393 ref = &ref_saved_style;
395 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
398 if (ImGui::CollapsingHeader(tr(
"Theme Management"),
399 ImGuiTreeNodeFlags_DefaultOpen)) {
401 static bool show_theme_selector =
false;
402 static bool show_theme_editor =
false;
407 std::string current_theme_name = theme_manager.GetCurrentThemeName();
408 bool is_classic_active = (current_theme_name ==
"Classic YAZE");
411 if (is_classic_active) {
412 ImGui::TextColored(ImVec4(0.2f, 0.8f, 0.2f, 1.0f),
"%s",
413 current_theme_name.c_str());
415 ImGui::Text(
"%s", current_theme_name.c_str());
419 auto current_theme = theme_manager.GetCurrentTheme();
421 ImGui::ColorButton(
"##primary_preview",
423 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
425 ImGui::ColorButton(
"##secondary_preview",
427 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
429 ImGui::ColorButton(
"##accent_preview",
431 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
436 if (ImGui::BeginTable(
437 "ThemeSelectionTable", 3,
438 ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_NoHostExtendY,
440 ImGui::TableSetupColumn(
"Built-in", ImGuiTableColumnFlags_WidthStretch,
442 ImGui::TableSetupColumn(
"File Themes", ImGuiTableColumnFlags_WidthStretch,
444 ImGui::TableSetupColumn(
"Actions", ImGuiTableColumnFlags_WidthStretch,
446 ImGui::TableHeadersRow();
448 ImGui::TableNextRow();
451 ImGui::TableNextColumn();
452 if (is_classic_active) {
453 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.2f, 0.6f, 0.2f, 1.0f));
456 if (ImGui::Button(tr(
"Classic YAZE"), ImVec2(-1, 30))) {
457 theme_manager.ApplyClassicYazeTheme();
458 ref_saved_style = style;
461 if (is_classic_active) {
462 ImGui::PopStyleColor();
465 if (ImGui::Button(tr(
"Reset ColorsYaze"), ImVec2(-1, 30))) {
467 ref_saved_style = style;
471 ImGui::TableNextColumn();
472 auto available_themes = theme_manager.GetAvailableThemes();
473 const char* current_file_theme =
"";
476 for (
const auto& theme_name : available_themes) {
477 if (theme_name == current_theme_name) {
478 current_file_theme = theme_name.c_str();
483 ImGui::SetNextItemWidth(-1);
484 if (ImGui::BeginCombo(
"##FileThemes", current_file_theme)) {
485 for (
const auto& theme_name : available_themes) {
486 bool is_selected = (theme_name == current_theme_name);
487 if (ImGui::Selectable(theme_name.c_str(), is_selected)) {
488 theme_manager.LoadTheme(theme_name);
489 ref_saved_style = style;
495 if (ImGui::Button(tr(
"Refresh Themes"), ImVec2(-1, 30))) {
496 theme_manager.RefreshAvailableThemes();
500 ImGui::TableNextColumn();
501 if (ImGui::Button(tr(
"Theme Selector"), ImVec2(-1, 30))) {
502 show_theme_selector =
true;
505 if (ImGui::Button(tr(
"Theme Editor"), ImVec2(-1, 30))) {
506 show_theme_editor =
true;
513 if (show_theme_selector) {
514 theme_manager.ShowThemeSelector(&show_theme_selector);
517 if (show_theme_editor) {
518 theme_manager.ShowSimpleThemeEditor(&show_theme_editor);
526 bg_renderer.DrawSettingsUI();
530 if (ImGui::ShowStyleSelector(
"Colors##Selector"))
531 ref_saved_style = style;
532 ImGui::ShowFontSelector(
"Fonts##Selector");
536 if (ImGui::SliderFloat(tr(
"FrameRounding"), &style.FrameRounding, 0.0f, 12.0f,
538 style.GrabRounding = style.FrameRounding;
541 bool border = (style.WindowBorderSize > 0.0f);
542 if (ImGui::Checkbox(tr(
"WindowBorder"), &border)) {
543 style.WindowBorderSize = border ? 1.0f : 0.0f;
548 bool border = (style.FrameBorderSize > 0.0f);
549 if (ImGui::Checkbox(tr(
"FrameBorder"), &border)) {
550 style.FrameBorderSize = border ? 1.0f : 0.0f;
555 bool border = (style.PopupBorderSize > 0.0f);
556 if (ImGui::Checkbox(tr(
"PopupBorder"), &border)) {
557 style.PopupBorderSize = border ? 1.0f : 0.0f;
562 if (ImGui::Button(tr(
"Save Ref")))
563 *ref = ref_saved_style = style;
565 if (ImGui::Button(tr(
"Revert Ref")))
571 if (ImGui::BeginTabBar(
"##tabs", ImGuiTabBarFlags_None)) {
572 if (ImGui::BeginTabItem(tr(
"Sizes"))) {
573 ImGui::SeparatorText(tr(
"Main"));
574 ImGui::SliderFloat2(
"WindowPadding", (
float*)&style.WindowPadding, 0.0f,
576 ImGui::SliderFloat2(
"FramePadding", (
float*)&style.FramePadding, 0.0f,
578 ImGui::SliderFloat2(
"ItemSpacing", (
float*)&style.ItemSpacing, 0.0f,
580 ImGui::SliderFloat2(
"ItemInnerSpacing", (
float*)&style.ItemInnerSpacing,
581 0.0f, 20.0f,
"%.0f");
582 ImGui::SliderFloat2(
"TouchExtraPadding", (
float*)&style.TouchExtraPadding,
583 0.0f, 10.0f,
"%.0f");
584 ImGui::SliderFloat(tr(
"IndentSpacing"), &style.IndentSpacing, 0.0f, 30.0f,
586 ImGui::SliderFloat(tr(
"ScrollbarSize"), &style.ScrollbarSize, 1.0f, 20.0f,
588 ImGui::SliderFloat(tr(
"GrabMinSize"), &style.GrabMinSize, 1.0f, 20.0f,
591 ImGui::SeparatorText(tr(
"Borders"));
592 ImGui::SliderFloat(tr(
"WindowBorderSize"), &style.WindowBorderSize, 0.0f,
594 ImGui::SliderFloat(tr(
"ChildBorderSize"), &style.ChildBorderSize, 0.0f,
596 ImGui::SliderFloat(tr(
"PopupBorderSize"), &style.PopupBorderSize, 0.0f,
598 ImGui::SliderFloat(tr(
"FrameBorderSize"), &style.FrameBorderSize, 0.0f,
600 ImGui::SliderFloat(tr(
"TabBorderSize"), &style.TabBorderSize, 0.0f, 1.0f,
602 ImGui::SliderFloat(tr(
"TabBarBorderSize"), &style.TabBarBorderSize, 0.0f,
605 ImGui::SeparatorText(tr(
"Rounding"));
606 ImGui::SliderFloat(tr(
"WindowRounding"), &style.WindowRounding, 0.0f,
608 ImGui::SliderFloat(tr(
"ChildRounding"), &style.ChildRounding, 0.0f, 12.0f,
610 ImGui::SliderFloat(tr(
"FrameRounding"), &style.FrameRounding, 0.0f, 12.0f,
612 ImGui::SliderFloat(tr(
"PopupRounding"), &style.PopupRounding, 0.0f, 12.0f,
614 ImGui::SliderFloat(tr(
"ScrollbarRounding"), &style.ScrollbarRounding,
615 0.0f, 12.0f,
"%.0f");
616 ImGui::SliderFloat(tr(
"GrabRounding"), &style.GrabRounding, 0.0f, 12.0f,
618 ImGui::SliderFloat(tr(
"TabRounding"), &style.TabRounding, 0.0f, 12.0f,
621 ImGui::SeparatorText(tr(
"Tables"));
622 ImGui::SliderFloat2(
"CellPadding", (
float*)&style.CellPadding, 0.0f,
624 ImGui::SliderAngle(
"TableAngledHeadersAngle",
625 &style.TableAngledHeadersAngle, -50.0f, +50.0f);
627 ImGui::SeparatorText(tr(
"Widgets"));
628 ImGui::SliderFloat2(
"WindowTitleAlign", (
float*)&style.WindowTitleAlign,
630 ImGui::Combo(tr(
"ColorButtonPosition"), (
int*)&style.ColorButtonPosition,
632 ImGui::SliderFloat2(
"ButtonTextAlign", (
float*)&style.ButtonTextAlign,
636 ImGui::SliderFloat2(
"SelectableTextAlign",
637 (
float*)&style.SelectableTextAlign, 0.0f, 1.0f,
641 ImGui::SliderFloat(tr(
"SeparatorTextBorderSize"),
642 &style.SeparatorTextBorderSize, 0.0f, 10.0f,
"%.0f");
643 ImGui::SliderFloat2(
"SeparatorTextAlign",
644 (
float*)&style.SeparatorTextAlign, 0.0f, 1.0f,
646 ImGui::SliderFloat2(
"SeparatorTextPadding",
647 (
float*)&style.SeparatorTextPadding, 0.0f, 40.0f,
649 ImGui::SliderFloat(tr(
"LogSliderDeadzone"), &style.LogSliderDeadzone,
650 0.0f, 12.0f,
"%.0f");
652 ImGui::SeparatorText(tr(
"Tooltips"));
653 for (
int n = 0; n < 2; n++)
654 if (ImGui::TreeNodeEx(n == 0 ?
"HoverFlagsForTooltipMouse"
655 :
"HoverFlagsForTooltipNav")) {
656 ImGuiHoveredFlags* p = (n == 0) ? &style.HoverFlagsForTooltipMouse
657 : &style.HoverFlagsForTooltipNav;
658 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNone", p,
659 ImGuiHoveredFlags_DelayNone);
660 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayShort", p,
661 ImGuiHoveredFlags_DelayShort);
662 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNormal", p,
663 ImGuiHoveredFlags_DelayNormal);
664 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_Stationary", p,
665 ImGuiHoveredFlags_Stationary);
666 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_NoSharedDelay", p,
667 ImGuiHoveredFlags_NoSharedDelay);
671 ImGui::SeparatorText(tr(
"Misc"));
672 ImGui::SliderFloat2(
"DisplaySafeAreaPadding",
673 (
float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f,
680 if (ImGui::BeginTabItem(tr(
"Colors"))) {
681 static int output_dest = 0;
682 static bool output_only_modified =
true;
683 if (ImGui::Button(tr(
"Export"))) {
684 if (output_dest == 0)
685 ImGui::LogToClipboard();
688 ImGui::LogText(
"ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
689 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
690 const ImVec4& col = style.Colors[i];
691 const char* name = ImGui::GetStyleColorName(i);
692 if (!output_only_modified ||
693 memcmp(&col, &ref->Colors[i],
sizeof(ImVec4)) != 0)
695 "colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, "
696 "%.2ff);" IM_NEWLINE,
697 name, 23 - (
int)strlen(name),
"", col.x, col.y, col.z, col.w);
702 ImGui::SetNextItemWidth(120);
703 ImGui::Combo(
"##output_type", &output_dest,
"To Clipboard\0To TTY\0");
705 ImGui::Checkbox(tr(
"Only Modified Colors"), &output_only_modified);
707 static ImGuiTextFilter filter;
708 filter.Draw(
"Filter colors", ImGui::GetFontSize() * 16);
710 static ImGuiColorEditFlags alpha_flags = 0;
711 if (ImGui::RadioButton(tr(
"Opaque"),
712 alpha_flags == ImGuiColorEditFlags_None)) {
713 alpha_flags = ImGuiColorEditFlags_None;
716 if (ImGui::RadioButton(tr(
"Alpha"),
717 alpha_flags == ImGuiColorEditFlags_AlphaPreview)) {
718 alpha_flags = ImGuiColorEditFlags_AlphaPreview;
721 if (ImGui::RadioButton(
723 alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) {
724 alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf;
728 ImGui::SetNextWindowSizeConstraints(
729 ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 10),
730 ImVec2(FLT_MAX, FLT_MAX));
731 ImGui::BeginChild(
"##colors", ImVec2(0, 0),
732 ImGuiChildFlags_Borders | ImGuiChildFlags_NavFlattened,
733 ImGuiWindowFlags_AlwaysVerticalScrollbar |
734 ImGuiWindowFlags_AlwaysHorizontalScrollbar);
735 ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
736 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
737 const char* name = ImGui::GetStyleColorName(i);
738 if (!filter.PassFilter(name))
741 ImGui::ColorEdit4(
"##color", (
float*)&style.Colors[i],
742 ImGuiColorEditFlags_AlphaBar | alpha_flags);
743 if (memcmp(&style.Colors[i], &ref->Colors[i],
sizeof(ImVec4)) != 0) {
748 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
749 if (ImGui::Button(tr(
"Save"))) {
750 ref->Colors[i] = style.Colors[i];
752 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
753 if (ImGui::Button(tr(
"Revert"))) {
754 style.Colors[i] = ref->Colors[i];
757 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
758 ImGui::TextUnformatted(name);
761 ImGui::PopItemWidth();
767 if (ImGui::BeginTabItem(tr(
"Fonts"))) {
768 ImGuiIO& io = ImGui::GetIO();
769 ImFontAtlas* atlas = io.Fonts;
770 ImGui::ShowFontAtlas(atlas);
776 const float MIN_SCALE = 0.3f;
777 const float MAX_SCALE = 2.0f;
779 static float window_scale = 1.0f;
780 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
781 if (ImGui::DragFloat(
782 tr(
"window scale"), &window_scale, 0.005f, MIN_SCALE, MAX_SCALE,
784 ImGuiSliderFlags_AlwaysClamp))
785 ImGui::SetWindowFontScale(window_scale);
788 ImGui::PopItemWidth();
793 if (ImGui::BeginTabItem(tr(
"Rendering"))) {
794 ImGui::Checkbox(tr(
"Anti-aliased lines"), &style.AntiAliasedLines);
797 ImGui::Checkbox(tr(
"Anti-aliased lines use texture"),
798 &style.AntiAliasedLinesUseTex);
801 ImGui::Checkbox(tr(
"Anti-aliased fill"), &style.AntiAliasedFill);
802 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
803 ImGui::DragFloat(tr(
"Curve Tessellation Tolerance"),
804 &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f,
806 if (style.CurveTessellationTol < 0.10f)
807 style.CurveTessellationTol = 0.10f;
811 ImGui::DragFloat(tr(
"Circle Tessellation Max Error"),
812 &style.CircleTessellationMaxError, 0.005f, 0.10f, 5.0f,
813 "%.2f", ImGuiSliderFlags_AlwaysClamp);
814 const bool show_samples = ImGui::IsItemActive();
816 ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
817 if (show_samples && ImGui::BeginTooltip()) {
818 ImGui::TextUnformatted(tr(
"(R = radius, N = number of segments)"));
820 ImDrawList* draw_list = ImGui::GetWindowDrawList();
821 const float min_widget_width = ImGui::CalcTextSize(
"N: MMM\nR: MMM").x;
822 for (
int n = 0; n < 8; n++) {
823 const float RAD_MIN = 5.0f;
824 const float RAD_MAX = 70.0f;
826 RAD_MIN + (RAD_MAX - RAD_MIN) * (
float)n / (8.0f - 1.0f);
830 ImGui::Text(tr(
"R: %.f\nN: %d"), rad,
831 draw_list->_CalcCircleAutoSegmentCount(rad));
833 const float canvas_width = std::max(min_widget_width, rad * 2.0f);
834 const float offset_x = floorf(canvas_width * 0.5f);
835 const float offset_y = floorf(RAD_MAX);
837 const ImVec2 p1 = ImGui::GetCursorScreenPos();
838 draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad,
839 ImGui::GetColorU32(ImGuiCol_Text));
840 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
856 ImGui::DragFloat(tr(
"Global Alpha"), &style.Alpha, 0.005f, 0.20f, 1.0f,
861 ImGui::DragFloat(tr(
"Disabled Alpha"), &style.DisabledAlpha, 0.005f, 0.0f,
865 ImGui::PopItemWidth();
873 ImGui::PopItemWidth();
878 ImGuiStyle& style = ImGui::GetStyle();
879 static ImGuiStyle ref_saved_style;
882 static bool init =
true;
883 if (init && ref == NULL)
884 ref_saved_style = style;
887 ref = &ref_saved_style;
889 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
892 if (ImGui::CollapsingHeader(tr(
"Theme Management"),
893 ImGuiTreeNodeFlags_DefaultOpen)) {
899 std::string current_theme_name = theme_manager.GetCurrentThemeName();
900 bool is_classic_active = (current_theme_name ==
"Classic YAZE");
903 if (is_classic_active) {
904 ImGui::TextColored(ImVec4(0.2f, 0.8f, 0.2f, 1.0f),
"%s",
905 current_theme_name.c_str());
907 ImGui::Text(
"%s", current_theme_name.c_str());
911 auto current_theme = theme_manager.GetCurrentTheme();
913 ImGui::ColorButton(
"##primary_preview",
915 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
917 ImGui::ColorButton(
"##secondary_preview",
919 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
921 ImGui::ColorButton(
"##accent_preview",
923 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
928 if (is_classic_active) {
929 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.2f, 0.6f, 0.2f, 1.0f));
932 if (ImGui::Button(tr(
"Classic YAZE"))) {
933 theme_manager.ApplyClassicYazeTheme();
934 ref_saved_style = style;
937 if (is_classic_active) {
938 ImGui::PopStyleColor();
942 if (ImGui::Button(tr(
"Reset ColorsYaze"))) {
944 ref_saved_style = style;
948 auto available_themes = theme_manager.GetAvailableThemes();
949 const char* current_file_theme =
"";
952 for (
const auto& theme_name : available_themes) {
953 if (theme_name == current_theme_name) {
954 current_file_theme = theme_name.c_str();
959 ImGui::Text(tr(
"File Themes:"));
960 ImGui::SetNextItemWidth(-1);
961 if (ImGui::BeginCombo(
"##FileThemes", current_file_theme)) {
962 for (
const auto& theme_name : available_themes) {
963 bool is_selected = (theme_name == current_theme_name);
964 if (ImGui::Selectable(theme_name.c_str(), is_selected)) {
965 theme_manager.LoadTheme(theme_name);
966 ref_saved_style = style;
972 if (ImGui::Button(tr(
"Refresh Themes"))) {
973 theme_manager.RefreshAvailableThemes();
976 if (ImGui::Button(tr(
"Open Theme Editor"))) {
977 static bool show_theme_editor =
true;
978 theme_manager.ShowSimpleThemeEditor(&show_theme_editor);
986 bg_renderer.DrawSettingsUI();
990 if (ImGui::ShowStyleSelector(
"Colors##Selector"))
991 ref_saved_style = style;
992 ImGui::ShowFontSelector(
"Fonts##Selector");
995 if (ImGui::SliderFloat(tr(
"FrameRounding"), &style.FrameRounding, 0.0f, 12.0f,
997 style.GrabRounding = style.FrameRounding;
1000 bool window_border = (style.WindowBorderSize > 0.0f);
1001 if (ImGui::Checkbox(tr(
"WindowBorder"), &window_border)) {
1002 style.WindowBorderSize = window_border ? 1.0f : 0.0f;
1006 bool frame_border = (style.FrameBorderSize > 0.0f);
1007 if (ImGui::Checkbox(tr(
"FrameBorder"), &frame_border)) {
1008 style.FrameBorderSize = frame_border ? 1.0f : 0.0f;
1012 bool popup_border = (style.PopupBorderSize > 0.0f);
1013 if (ImGui::Checkbox(tr(
"PopupBorder"), &popup_border)) {
1014 style.PopupBorderSize = popup_border ? 1.0f : 0.0f;
1018 if (ImGui::Button(tr(
"Save Ref")))
1019 *ref = ref_saved_style = style;
1021 if (ImGui::Button(tr(
"Revert Ref")))
1027 if (ImGui::BeginTabBar(
"DisplaySettingsTabs", ImGuiTabBarFlags_None)) {
1028 if (ImGui::BeginTabItem(tr(
"Sizes"))) {
1029 ImGui::SeparatorText(tr(
"Main"));
1030 ImGui::SliderFloat2(
"WindowPadding", (
float*)&style.WindowPadding, 0.0f,
1032 ImGui::SliderFloat2(
"FramePadding", (
float*)&style.FramePadding, 0.0f,
1034 ImGui::SliderFloat2(
"ItemSpacing", (
float*)&style.ItemSpacing, 0.0f,
1036 ImGui::SliderFloat2(
"ItemInnerSpacing", (
float*)&style.ItemInnerSpacing,
1037 0.0f, 20.0f,
"%.0f");
1038 ImGui::SliderFloat2(
"TouchExtraPadding", (
float*)&style.TouchExtraPadding,
1039 0.0f, 10.0f,
"%.0f");
1040 ImGui::SliderFloat(tr(
"IndentSpacing"), &style.IndentSpacing, 0.0f, 30.0f,
1042 ImGui::SliderFloat(tr(
"ScrollbarSize"), &style.ScrollbarSize, 1.0f, 20.0f,
1044 ImGui::SliderFloat(tr(
"GrabMinSize"), &style.GrabMinSize, 1.0f, 20.0f,
1047 ImGui::SeparatorText(tr(
"Borders"));
1048 ImGui::SliderFloat(tr(
"WindowBorderSize"), &style.WindowBorderSize, 0.0f,
1050 ImGui::SliderFloat(tr(
"ChildBorderSize"), &style.ChildBorderSize, 0.0f,
1052 ImGui::SliderFloat(tr(
"PopupBorderSize"), &style.PopupBorderSize, 0.0f,
1054 ImGui::SliderFloat(tr(
"FrameBorderSize"), &style.FrameBorderSize, 0.0f,
1056 ImGui::SliderFloat(tr(
"TabBorderSize"), &style.TabBorderSize, 0.0f, 1.0f,
1058 ImGui::SliderFloat(tr(
"TabBarBorderSize"), &style.TabBarBorderSize, 0.0f,
1061 ImGui::SeparatorText(tr(
"Rounding"));
1062 ImGui::SliderFloat(tr(
"WindowRounding"), &style.WindowRounding, 0.0f,
1064 ImGui::SliderFloat(tr(
"ChildRounding"), &style.ChildRounding, 0.0f, 12.0f,
1066 ImGui::SliderFloat(tr(
"FrameRounding"), &style.FrameRounding, 0.0f, 12.0f,
1068 ImGui::SliderFloat(tr(
"PopupRounding"), &style.PopupRounding, 0.0f, 12.0f,
1070 ImGui::SliderFloat(tr(
"ScrollbarRounding"), &style.ScrollbarRounding,
1071 0.0f, 12.0f,
"%.0f");
1072 ImGui::SliderFloat(tr(
"GrabRounding"), &style.GrabRounding, 0.0f, 12.0f,
1074 ImGui::SliderFloat(tr(
"TabRounding"), &style.TabRounding, 0.0f, 12.0f,
1077 ImGui::SeparatorText(tr(
"Tables"));
1078 ImGui::SliderFloat2(
"CellPadding", (
float*)&style.CellPadding, 0.0f,
1080 ImGui::SliderAngle(
"TableAngledHeadersAngle",
1081 &style.TableAngledHeadersAngle, -50.0f, +50.0f);
1083 ImGui::SeparatorText(tr(
"Widgets"));
1084 ImGui::SliderFloat2(
"WindowTitleAlign", (
float*)&style.WindowTitleAlign,
1085 0.0f, 1.0f,
"%.2f");
1086 ImGui::Combo(tr(
"ColorButtonPosition"), (
int*)&style.ColorButtonPosition,
1088 ImGui::SliderFloat2(
"ButtonTextAlign", (
float*)&style.ButtonTextAlign,
1089 0.0f, 1.0f,
"%.2f");
1092 ImGui::SliderFloat2(
"SelectableTextAlign",
1093 (
float*)&style.SelectableTextAlign, 0.0f, 1.0f,
1097 ImGui::SliderFloat(tr(
"SeparatorTextBorderSize"),
1098 &style.SeparatorTextBorderSize, 0.0f, 10.0f,
"%.0f");
1099 ImGui::SliderFloat2(
"SeparatorTextAlign",
1100 (
float*)&style.SeparatorTextAlign, 0.0f, 1.0f,
1102 ImGui::SliderFloat2(
"SeparatorTextPadding",
1103 (
float*)&style.SeparatorTextPadding, 0.0f, 40.0f,
1105 ImGui::SliderFloat(tr(
"LogSliderDeadzone"), &style.LogSliderDeadzone,
1106 0.0f, 12.0f,
"%.0f");
1108 ImGui::SeparatorText(tr(
"Tooltips"));
1109 for (
int n = 0; n < 2; n++)
1110 if (ImGui::TreeNodeEx(n == 0 ?
"HoverFlagsForTooltipMouse"
1111 :
"HoverFlagsForTooltipNav")) {
1112 ImGuiHoveredFlags* p = (n == 0) ? &style.HoverFlagsForTooltipMouse
1113 : &style.HoverFlagsForTooltipNav;
1114 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNone", p,
1115 ImGuiHoveredFlags_DelayNone);
1116 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayShort", p,
1117 ImGuiHoveredFlags_DelayShort);
1118 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNormal", p,
1119 ImGuiHoveredFlags_DelayNormal);
1120 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_Stationary", p,
1121 ImGuiHoveredFlags_Stationary);
1122 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_NoSharedDelay", p,
1123 ImGuiHoveredFlags_NoSharedDelay);
1127 ImGui::SeparatorText(tr(
"Misc"));
1128 ImGui::SliderFloat2(
"DisplaySafeAreaPadding",
1129 (
float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f,
1133 ImGui::EndTabItem();
1136 if (ImGui::BeginTabItem(tr(
"Colors"))) {
1137 static int output_dest = 0;
1138 static bool output_only_modified =
true;
1139 if (ImGui::Button(tr(
"Export"))) {
1140 if (output_dest == 0)
1141 ImGui::LogToClipboard();
1144 ImGui::LogText(
"ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
1145 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
1146 const ImVec4& col = style.Colors[i];
1147 const char* name = ImGui::GetStyleColorName(i);
1148 if (!output_only_modified ||
1149 memcmp(&col, &ref->Colors[i],
sizeof(ImVec4)) != 0)
1151 "colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, "
1152 "%.2ff);" IM_NEWLINE,
1153 name, 23 - (
int)strlen(name),
"", col.x, col.y, col.z, col.w);
1158 ImGui::SetNextItemWidth(120);
1159 ImGui::Combo(
"##output_type", &output_dest,
"To Clipboard\0To TTY\0");
1161 ImGui::Checkbox(tr(
"Only Modified Colors"), &output_only_modified);
1163 static ImGuiTextFilter filter;
1164 filter.Draw(
"Filter colors", ImGui::GetFontSize() * 16);
1166 static ImGuiColorEditFlags alpha_flags = 0;
1167 if (ImGui::RadioButton(tr(
"Opaque"),
1168 alpha_flags == ImGuiColorEditFlags_None)) {
1169 alpha_flags = ImGuiColorEditFlags_None;
1172 if (ImGui::RadioButton(tr(
"Alpha"),
1173 alpha_flags == ImGuiColorEditFlags_AlphaPreview)) {
1174 alpha_flags = ImGuiColorEditFlags_AlphaPreview;
1177 if (ImGui::RadioButton(
1179 alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) {
1180 alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf;
1184 ImGui::SetNextWindowSizeConstraints(
1185 ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 10),
1186 ImVec2(FLT_MAX, FLT_MAX));
1187 ImGui::BeginChild(
"##colors", ImVec2(0, 0),
1188 ImGuiChildFlags_Borders | ImGuiChildFlags_NavFlattened,
1189 ImGuiWindowFlags_AlwaysVerticalScrollbar |
1190 ImGuiWindowFlags_AlwaysHorizontalScrollbar);
1191 ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
1192 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
1193 const char* name = ImGui::GetStyleColorName(i);
1194 if (!filter.PassFilter(name))
1197 ImGui::ColorEdit4(
"##color", (
float*)&style.Colors[i],
1198 ImGuiColorEditFlags_AlphaBar | alpha_flags);
1199 if (memcmp(&style.Colors[i], &ref->Colors[i],
sizeof(ImVec4)) != 0) {
1204 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
1205 if (ImGui::Button(tr(
"Save"))) {
1206 ref->Colors[i] = style.Colors[i];
1208 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
1209 if (ImGui::Button(tr(
"Revert"))) {
1210 style.Colors[i] = ref->Colors[i];
1213 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
1214 ImGui::TextUnformatted(name);
1217 ImGui::PopItemWidth();
1220 ImGui::EndTabItem();
1223 if (ImGui::BeginTabItem(tr(
"Fonts"))) {
1224 ImGuiIO& io = ImGui::GetIO();
1225 ImFontAtlas* atlas = io.Fonts;
1226 ImGui::ShowFontAtlas(atlas);
1232 const float MIN_SCALE = 0.3f;
1233 const float MAX_SCALE = 2.0f;
1235 static float window_scale = 1.0f;
1236 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
1237 if (ImGui::DragFloat(
1238 tr(
"window scale"), &window_scale, 0.005f, MIN_SCALE, MAX_SCALE,
1240 ImGuiSliderFlags_AlwaysClamp))
1241 ImGui::SetWindowFontScale(window_scale);
1244 ImGui::PopItemWidth();
1246 ImGui::EndTabItem();
1249 if (ImGui::BeginTabItem(tr(
"Rendering"))) {
1250 ImGui::Checkbox(tr(
"Anti-aliased lines"), &style.AntiAliasedLines);
1253 ImGui::Checkbox(tr(
"Anti-aliased lines use texture"),
1254 &style.AntiAliasedLinesUseTex);
1257 ImGui::Checkbox(tr(
"Anti-aliased fill"), &style.AntiAliasedFill);
1258 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
1259 ImGui::DragFloat(tr(
"Curve Tessellation Tolerance"),
1260 &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f,
1262 if (style.CurveTessellationTol < 0.10f)
1263 style.CurveTessellationTol = 0.10f;
1267 ImGui::DragFloat(tr(
"Circle Tessellation Max Error"),
1268 &style.CircleTessellationMaxError, 0.005f, 0.10f, 5.0f,
1269 "%.2f", ImGuiSliderFlags_AlwaysClamp);
1270 const bool show_samples = ImGui::IsItemActive();
1272 ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
1273 if (show_samples && ImGui::BeginTooltip()) {
1274 ImGui::TextUnformatted(tr(
"(R = radius, N = number of segments)"));
1276 ImDrawList* draw_list = ImGui::GetWindowDrawList();
1277 const float min_widget_width = ImGui::CalcTextSize(
"N: MMM\nR: MMM").x;
1278 for (
int n = 0; n < 8; n++) {
1279 const float RAD_MIN = 5.0f;
1280 const float RAD_MAX = 70.0f;
1282 RAD_MIN + (RAD_MAX - RAD_MIN) * (
float)n / (8.0f - 1.0f);
1284 ImGui::BeginGroup();
1286 ImGui::Text(tr(
"R: %.f\nN: %d"), rad,
1287 draw_list->_CalcCircleAutoSegmentCount(rad));
1289 const float canvas_width = std::max(min_widget_width, rad * 2.0f);
1290 const float offset_x = floorf(canvas_width * 0.5f);
1291 const float offset_y = floorf(RAD_MAX);
1293 const ImVec2 p1 = ImGui::GetCursorScreenPos();
1294 draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad,
1295 ImGui::GetColorU32(ImGuiCol_Text));
1296 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
1301 ImGui::EndTooltip();
1305 ImGui::DragFloat(tr(
"Global Alpha"), &style.Alpha, 0.005f, 0.20f, 1.0f,
1310 ImGui::DragFloat(tr(
"Disabled Alpha"), &style.DisabledAlpha, 0.005f, 0.0f,
1314 ImGui::PopItemWidth();
1316 ImGui::EndTabItem();
1322 ImGui::PopItemWidth();