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);
137 colors[ImGuiCol_DockingPreview] = ImVec4(0.36f, 0.45f, 0.36f, 0.71f);
138 colors[ImGuiCol_DockingEmptyBg] = alttpDarkGreen;
139 colors[ImGuiCol_InputTextCursor] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
140 colors[ImGuiCol_TextLink] = allttpLightestGreen;
141 colors[ImGuiCol_TreeLines] = colors[ImGuiCol_Separator];
142 colors[ImGuiCol_TabSelectedOverline] = allttpLightestGreen;
143 colors[ImGuiCol_TabDimmedSelectedOverline] = allttpLightestGreen;
146 colors[ImGuiCol_DragDropTargetBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
147 colors[ImGuiCol_UnsavedMarker] = colors[ImGuiCol_Text];
148 style->GrabRounding = 5.f;
149 style->TabRounding = 0.f;
403 ImGuiStyle& style = ImGui::GetStyle();
404 static ImGuiStyle ref_saved_style;
407 static bool init =
true;
408 if (init && ref == NULL)
409 ref_saved_style = style;
412 ref = &ref_saved_style;
414 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
417 if (ImGui::CollapsingHeader(tr(
"Theme Management"),
418 ImGuiTreeNodeFlags_DefaultOpen)) {
420 static bool show_theme_selector =
false;
421 static bool show_theme_editor =
false;
426 std::string current_theme_name = theme_manager.GetCurrentThemeName();
427 bool is_classic_active = (current_theme_name ==
"Classic YAZE");
430 if (is_classic_active) {
431 ImGui::TextColored(ImVec4(0.2f, 0.8f, 0.2f, 1.0f),
"%s",
432 current_theme_name.c_str());
434 ImGui::Text(
"%s", current_theme_name.c_str());
438 auto current_theme = theme_manager.GetCurrentTheme();
440 ImGui::ColorButton(
"##primary_preview",
442 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
444 ImGui::ColorButton(
"##secondary_preview",
446 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
448 ImGui::ColorButton(
"##accent_preview",
450 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
455 if (ImGui::BeginTable(
456 "ThemeSelectionTable", 3,
457 ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_NoHostExtendY,
459 ImGui::TableSetupColumn(
"Built-in", ImGuiTableColumnFlags_WidthStretch,
461 ImGui::TableSetupColumn(
"File Themes", ImGuiTableColumnFlags_WidthStretch,
463 ImGui::TableSetupColumn(
"Actions", ImGuiTableColumnFlags_WidthStretch,
465 ImGui::TableHeadersRow();
467 ImGui::TableNextRow();
470 ImGui::TableNextColumn();
471 if (is_classic_active) {
472 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.2f, 0.6f, 0.2f, 1.0f));
475 if (ImGui::Button(tr(
"Classic YAZE"), ImVec2(-1, 30))) {
476 theme_manager.ApplyClassicYazeTheme();
477 ref_saved_style = style;
480 if (is_classic_active) {
481 ImGui::PopStyleColor();
484 if (ImGui::Button(tr(
"Reset ColorsYaze"), ImVec2(-1, 30))) {
486 ref_saved_style = style;
490 ImGui::TableNextColumn();
491 auto available_themes = theme_manager.GetAvailableThemes();
492 const char* current_file_theme =
"";
495 for (
const auto& theme_name : available_themes) {
496 if (theme_name == current_theme_name) {
497 current_file_theme = theme_name.c_str();
502 ImGui::SetNextItemWidth(-1);
503 if (ImGui::BeginCombo(
"##FileThemes", current_file_theme)) {
504 for (
const auto& theme_name : available_themes) {
505 bool is_selected = (theme_name == current_theme_name);
506 if (ImGui::Selectable(theme_name.c_str(), is_selected)) {
507 theme_manager.LoadTheme(theme_name);
508 ref_saved_style = style;
514 if (ImGui::Button(tr(
"Refresh Themes"), ImVec2(-1, 30))) {
515 theme_manager.RefreshAvailableThemes();
519 ImGui::TableNextColumn();
520 if (ImGui::Button(tr(
"Theme Selector"), ImVec2(-1, 30))) {
521 show_theme_selector =
true;
524 if (ImGui::Button(tr(
"Theme Editor"), ImVec2(-1, 30))) {
525 show_theme_editor =
true;
532 if (show_theme_selector) {
533 theme_manager.ShowThemeSelector(&show_theme_selector);
536 if (show_theme_editor) {
537 theme_manager.ShowSimpleThemeEditor(&show_theme_editor);
545 bg_renderer.DrawSettingsUI();
549 if (ImGui::ShowStyleSelector(
"Colors##Selector"))
550 ref_saved_style = style;
551 ImGui::ShowFontSelector(
"Fonts##Selector");
555 if (ImGui::SliderFloat(tr(
"FrameRounding"), &style.FrameRounding, 0.0f, 12.0f,
557 style.GrabRounding = style.FrameRounding;
560 bool border = (style.WindowBorderSize > 0.0f);
561 if (ImGui::Checkbox(tr(
"WindowBorder"), &border)) {
562 style.WindowBorderSize = border ? 1.0f : 0.0f;
567 bool border = (style.FrameBorderSize > 0.0f);
568 if (ImGui::Checkbox(tr(
"FrameBorder"), &border)) {
569 style.FrameBorderSize = border ? 1.0f : 0.0f;
574 bool border = (style.PopupBorderSize > 0.0f);
575 if (ImGui::Checkbox(tr(
"PopupBorder"), &border)) {
576 style.PopupBorderSize = border ? 1.0f : 0.0f;
581 if (ImGui::Button(tr(
"Save Ref")))
582 *ref = ref_saved_style = style;
584 if (ImGui::Button(tr(
"Revert Ref")))
590 if (ImGui::BeginTabBar(
"##tabs", ImGuiTabBarFlags_None)) {
591 if (ImGui::BeginTabItem(tr(
"Sizes"))) {
592 ImGui::SeparatorText(tr(
"Main"));
593 ImGui::SliderFloat2(
"WindowPadding", (
float*)&style.WindowPadding, 0.0f,
595 ImGui::SliderFloat2(
"FramePadding", (
float*)&style.FramePadding, 0.0f,
597 ImGui::SliderFloat2(
"ItemSpacing", (
float*)&style.ItemSpacing, 0.0f,
599 ImGui::SliderFloat2(
"ItemInnerSpacing", (
float*)&style.ItemInnerSpacing,
600 0.0f, 20.0f,
"%.0f");
601 ImGui::SliderFloat2(
"TouchExtraPadding", (
float*)&style.TouchExtraPadding,
602 0.0f, 10.0f,
"%.0f");
603 ImGui::SliderFloat(tr(
"IndentSpacing"), &style.IndentSpacing, 0.0f, 30.0f,
605 ImGui::SliderFloat(tr(
"ScrollbarSize"), &style.ScrollbarSize, 1.0f, 20.0f,
607 ImGui::SliderFloat(tr(
"GrabMinSize"), &style.GrabMinSize, 1.0f, 20.0f,
610 ImGui::SeparatorText(tr(
"Borders"));
611 ImGui::SliderFloat(tr(
"WindowBorderSize"), &style.WindowBorderSize, 0.0f,
613 ImGui::SliderFloat(tr(
"ChildBorderSize"), &style.ChildBorderSize, 0.0f,
615 ImGui::SliderFloat(tr(
"PopupBorderSize"), &style.PopupBorderSize, 0.0f,
617 ImGui::SliderFloat(tr(
"FrameBorderSize"), &style.FrameBorderSize, 0.0f,
619 ImGui::SliderFloat(tr(
"TabBorderSize"), &style.TabBorderSize, 0.0f, 1.0f,
621 ImGui::SliderFloat(tr(
"TabBarBorderSize"), &style.TabBarBorderSize, 0.0f,
624 ImGui::SeparatorText(tr(
"Rounding"));
625 ImGui::SliderFloat(tr(
"WindowRounding"), &style.WindowRounding, 0.0f,
627 ImGui::SliderFloat(tr(
"ChildRounding"), &style.ChildRounding, 0.0f, 12.0f,
629 ImGui::SliderFloat(tr(
"FrameRounding"), &style.FrameRounding, 0.0f, 12.0f,
631 ImGui::SliderFloat(tr(
"PopupRounding"), &style.PopupRounding, 0.0f, 12.0f,
633 ImGui::SliderFloat(tr(
"ScrollbarRounding"), &style.ScrollbarRounding,
634 0.0f, 12.0f,
"%.0f");
635 ImGui::SliderFloat(tr(
"GrabRounding"), &style.GrabRounding, 0.0f, 12.0f,
637 ImGui::SliderFloat(tr(
"TabRounding"), &style.TabRounding, 0.0f, 12.0f,
640 ImGui::SeparatorText(tr(
"Tables"));
641 ImGui::SliderFloat2(
"CellPadding", (
float*)&style.CellPadding, 0.0f,
643 ImGui::SliderAngle(
"TableAngledHeadersAngle",
644 &style.TableAngledHeadersAngle, -50.0f, +50.0f);
646 ImGui::SeparatorText(tr(
"Widgets"));
647 ImGui::SliderFloat2(
"WindowTitleAlign", (
float*)&style.WindowTitleAlign,
649 ImGui::Combo(tr(
"ColorButtonPosition"), (
int*)&style.ColorButtonPosition,
651 ImGui::SliderFloat2(
"ButtonTextAlign", (
float*)&style.ButtonTextAlign,
655 ImGui::SliderFloat2(
"SelectableTextAlign",
656 (
float*)&style.SelectableTextAlign, 0.0f, 1.0f,
660 ImGui::SliderFloat(tr(
"SeparatorTextBorderSize"),
661 &style.SeparatorTextBorderSize, 0.0f, 10.0f,
"%.0f");
662 ImGui::SliderFloat2(
"SeparatorTextAlign",
663 (
float*)&style.SeparatorTextAlign, 0.0f, 1.0f,
665 ImGui::SliderFloat2(
"SeparatorTextPadding",
666 (
float*)&style.SeparatorTextPadding, 0.0f, 40.0f,
668 ImGui::SliderFloat(tr(
"LogSliderDeadzone"), &style.LogSliderDeadzone,
669 0.0f, 12.0f,
"%.0f");
671 ImGui::SeparatorText(tr(
"Tooltips"));
672 for (
int n = 0; n < 2; n++)
673 if (ImGui::TreeNodeEx(n == 0 ?
"HoverFlagsForTooltipMouse"
674 :
"HoverFlagsForTooltipNav")) {
675 ImGuiHoveredFlags* p = (n == 0) ? &style.HoverFlagsForTooltipMouse
676 : &style.HoverFlagsForTooltipNav;
677 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNone", p,
678 ImGuiHoveredFlags_DelayNone);
679 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayShort", p,
680 ImGuiHoveredFlags_DelayShort);
681 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNormal", p,
682 ImGuiHoveredFlags_DelayNormal);
683 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_Stationary", p,
684 ImGuiHoveredFlags_Stationary);
685 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_NoSharedDelay", p,
686 ImGuiHoveredFlags_NoSharedDelay);
690 ImGui::SeparatorText(tr(
"Misc"));
691 ImGui::SliderFloat2(
"DisplaySafeAreaPadding",
692 (
float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f,
699 if (ImGui::BeginTabItem(tr(
"Colors"))) {
700 static int output_dest = 0;
701 static bool output_only_modified =
true;
702 if (ImGui::Button(tr(
"Export"))) {
703 if (output_dest == 0)
704 ImGui::LogToClipboard();
707 ImGui::LogText(
"ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
708 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
709 const ImVec4& col = style.Colors[i];
710 const char* name = ImGui::GetStyleColorName(i);
711 if (!output_only_modified ||
712 memcmp(&col, &ref->Colors[i],
sizeof(ImVec4)) != 0)
714 "colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, "
715 "%.2ff);" IM_NEWLINE,
716 name, 23 - (
int)strlen(name),
"", col.x, col.y, col.z, col.w);
721 ImGui::SetNextItemWidth(120);
722 ImGui::Combo(
"##output_type", &output_dest,
"To Clipboard\0To TTY\0");
724 ImGui::Checkbox(tr(
"Only Modified Colors"), &output_only_modified);
726 static ImGuiTextFilter filter;
727 filter.Draw(
"Filter colors", ImGui::GetFontSize() * 16);
729 static ImGuiColorEditFlags alpha_flags = 0;
730 if (ImGui::RadioButton(tr(
"Opaque"),
731 alpha_flags == ImGuiColorEditFlags_None)) {
732 alpha_flags = ImGuiColorEditFlags_None;
735 if (ImGui::RadioButton(tr(
"Alpha"),
736 alpha_flags == ImGuiColorEditFlags_AlphaPreview)) {
737 alpha_flags = ImGuiColorEditFlags_AlphaPreview;
740 if (ImGui::RadioButton(
742 alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) {
743 alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf;
747 ImGui::SetNextWindowSizeConstraints(
748 ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 10),
749 ImVec2(FLT_MAX, FLT_MAX));
750 ImGui::BeginChild(
"##colors", ImVec2(0, 0),
751 ImGuiChildFlags_Borders | ImGuiChildFlags_NavFlattened,
752 ImGuiWindowFlags_AlwaysVerticalScrollbar |
753 ImGuiWindowFlags_AlwaysHorizontalScrollbar);
754 ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
755 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
756 const char* name = ImGui::GetStyleColorName(i);
757 if (!filter.PassFilter(name))
760 ImGui::ColorEdit4(
"##color", (
float*)&style.Colors[i],
761 ImGuiColorEditFlags_AlphaBar | alpha_flags);
762 if (memcmp(&style.Colors[i], &ref->Colors[i],
sizeof(ImVec4)) != 0) {
767 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
768 if (ImGui::Button(tr(
"Save"))) {
769 ref->Colors[i] = style.Colors[i];
771 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
772 if (ImGui::Button(tr(
"Revert"))) {
773 style.Colors[i] = ref->Colors[i];
776 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
777 ImGui::TextUnformatted(name);
780 ImGui::PopItemWidth();
786 if (ImGui::BeginTabItem(tr(
"Fonts"))) {
787 ImGuiIO& io = ImGui::GetIO();
788 ImFontAtlas* atlas = io.Fonts;
789 ImGui::ShowFontAtlas(atlas);
795 const float MIN_SCALE = 0.3f;
796 const float MAX_SCALE = 2.0f;
798 static float window_scale = 1.0f;
799 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
800 if (ImGui::DragFloat(
801 tr(
"window scale"), &window_scale, 0.005f, MIN_SCALE, MAX_SCALE,
803 ImGuiSliderFlags_AlwaysClamp))
804 ImGui::SetWindowFontScale(window_scale);
807 ImGui::PopItemWidth();
812 if (ImGui::BeginTabItem(tr(
"Rendering"))) {
813 ImGui::Checkbox(tr(
"Anti-aliased lines"), &style.AntiAliasedLines);
816 ImGui::Checkbox(tr(
"Anti-aliased lines use texture"),
817 &style.AntiAliasedLinesUseTex);
820 ImGui::Checkbox(tr(
"Anti-aliased fill"), &style.AntiAliasedFill);
821 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
822 ImGui::DragFloat(tr(
"Curve Tessellation Tolerance"),
823 &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f,
825 if (style.CurveTessellationTol < 0.10f)
826 style.CurveTessellationTol = 0.10f;
830 ImGui::DragFloat(tr(
"Circle Tessellation Max Error"),
831 &style.CircleTessellationMaxError, 0.005f, 0.10f, 5.0f,
832 "%.2f", ImGuiSliderFlags_AlwaysClamp);
833 const bool show_samples = ImGui::IsItemActive();
835 ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
836 if (show_samples && ImGui::BeginTooltip()) {
837 ImGui::TextUnformatted(tr(
"(R = radius, N = number of segments)"));
839 ImDrawList* draw_list = ImGui::GetWindowDrawList();
840 const float min_widget_width = ImGui::CalcTextSize(
"N: MMM\nR: MMM").x;
841 for (
int n = 0; n < 8; n++) {
842 const float RAD_MIN = 5.0f;
843 const float RAD_MAX = 70.0f;
845 RAD_MIN + (RAD_MAX - RAD_MIN) * (
float)n / (8.0f - 1.0f);
849 ImGui::Text(tr(
"R: %.f\nN: %d"), rad,
850 draw_list->_CalcCircleAutoSegmentCount(rad));
852 const float canvas_width = std::max(min_widget_width, rad * 2.0f);
853 const float offset_x = floorf(canvas_width * 0.5f);
854 const float offset_y = floorf(RAD_MAX);
856 const ImVec2 p1 = ImGui::GetCursorScreenPos();
857 draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad,
858 ImGui::GetColorU32(ImGuiCol_Text));
859 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
875 ImGui::DragFloat(tr(
"Global Alpha"), &style.Alpha, 0.005f, 0.20f, 1.0f,
880 ImGui::DragFloat(tr(
"Disabled Alpha"), &style.DisabledAlpha, 0.005f, 0.0f,
884 ImGui::PopItemWidth();
892 ImGui::PopItemWidth();
897 ImGuiStyle& style = ImGui::GetStyle();
898 static ImGuiStyle ref_saved_style;
901 static bool init =
true;
902 if (init && ref == NULL)
903 ref_saved_style = style;
906 ref = &ref_saved_style;
908 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
911 if (ImGui::CollapsingHeader(tr(
"Theme Management"),
912 ImGuiTreeNodeFlags_DefaultOpen)) {
918 std::string current_theme_name = theme_manager.GetCurrentThemeName();
919 bool is_classic_active = (current_theme_name ==
"Classic YAZE");
922 if (is_classic_active) {
923 ImGui::TextColored(ImVec4(0.2f, 0.8f, 0.2f, 1.0f),
"%s",
924 current_theme_name.c_str());
926 ImGui::Text(
"%s", current_theme_name.c_str());
930 auto current_theme = theme_manager.GetCurrentTheme();
932 ImGui::ColorButton(
"##primary_preview",
934 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
936 ImGui::ColorButton(
"##secondary_preview",
938 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
940 ImGui::ColorButton(
"##accent_preview",
942 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
947 if (is_classic_active) {
948 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.2f, 0.6f, 0.2f, 1.0f));
951 if (ImGui::Button(tr(
"Classic YAZE"))) {
952 theme_manager.ApplyClassicYazeTheme();
953 ref_saved_style = style;
956 if (is_classic_active) {
957 ImGui::PopStyleColor();
961 if (ImGui::Button(tr(
"Reset ColorsYaze"))) {
963 ref_saved_style = style;
967 auto available_themes = theme_manager.GetAvailableThemes();
968 const char* current_file_theme =
"";
971 for (
const auto& theme_name : available_themes) {
972 if (theme_name == current_theme_name) {
973 current_file_theme = theme_name.c_str();
978 ImGui::Text(tr(
"File Themes:"));
979 ImGui::SetNextItemWidth(-1);
980 if (ImGui::BeginCombo(
"##FileThemes", current_file_theme)) {
981 for (
const auto& theme_name : available_themes) {
982 bool is_selected = (theme_name == current_theme_name);
983 if (ImGui::Selectable(theme_name.c_str(), is_selected)) {
984 theme_manager.LoadTheme(theme_name);
985 ref_saved_style = style;
991 if (ImGui::Button(tr(
"Refresh Themes"))) {
992 theme_manager.RefreshAvailableThemes();
995 if (ImGui::Button(tr(
"Open Theme Editor"))) {
996 static bool show_theme_editor =
true;
997 theme_manager.ShowSimpleThemeEditor(&show_theme_editor);
1005 bg_renderer.DrawSettingsUI();
1009 if (ImGui::ShowStyleSelector(
"Colors##Selector"))
1010 ref_saved_style = style;
1011 ImGui::ShowFontSelector(
"Fonts##Selector");
1014 if (ImGui::SliderFloat(tr(
"FrameRounding"), &style.FrameRounding, 0.0f, 12.0f,
1016 style.GrabRounding = style.FrameRounding;
1019 bool window_border = (style.WindowBorderSize > 0.0f);
1020 if (ImGui::Checkbox(tr(
"WindowBorder"), &window_border)) {
1021 style.WindowBorderSize = window_border ? 1.0f : 0.0f;
1025 bool frame_border = (style.FrameBorderSize > 0.0f);
1026 if (ImGui::Checkbox(tr(
"FrameBorder"), &frame_border)) {
1027 style.FrameBorderSize = frame_border ? 1.0f : 0.0f;
1031 bool popup_border = (style.PopupBorderSize > 0.0f);
1032 if (ImGui::Checkbox(tr(
"PopupBorder"), &popup_border)) {
1033 style.PopupBorderSize = popup_border ? 1.0f : 0.0f;
1037 if (ImGui::Button(tr(
"Save Ref")))
1038 *ref = ref_saved_style = style;
1040 if (ImGui::Button(tr(
"Revert Ref")))
1046 if (ImGui::BeginTabBar(
"DisplaySettingsTabs", ImGuiTabBarFlags_None)) {
1047 if (ImGui::BeginTabItem(tr(
"Sizes"))) {
1048 ImGui::SeparatorText(tr(
"Main"));
1049 ImGui::SliderFloat2(
"WindowPadding", (
float*)&style.WindowPadding, 0.0f,
1051 ImGui::SliderFloat2(
"FramePadding", (
float*)&style.FramePadding, 0.0f,
1053 ImGui::SliderFloat2(
"ItemSpacing", (
float*)&style.ItemSpacing, 0.0f,
1055 ImGui::SliderFloat2(
"ItemInnerSpacing", (
float*)&style.ItemInnerSpacing,
1056 0.0f, 20.0f,
"%.0f");
1057 ImGui::SliderFloat2(
"TouchExtraPadding", (
float*)&style.TouchExtraPadding,
1058 0.0f, 10.0f,
"%.0f");
1059 ImGui::SliderFloat(tr(
"IndentSpacing"), &style.IndentSpacing, 0.0f, 30.0f,
1061 ImGui::SliderFloat(tr(
"ScrollbarSize"), &style.ScrollbarSize, 1.0f, 20.0f,
1063 ImGui::SliderFloat(tr(
"GrabMinSize"), &style.GrabMinSize, 1.0f, 20.0f,
1066 ImGui::SeparatorText(tr(
"Borders"));
1067 ImGui::SliderFloat(tr(
"WindowBorderSize"), &style.WindowBorderSize, 0.0f,
1069 ImGui::SliderFloat(tr(
"ChildBorderSize"), &style.ChildBorderSize, 0.0f,
1071 ImGui::SliderFloat(tr(
"PopupBorderSize"), &style.PopupBorderSize, 0.0f,
1073 ImGui::SliderFloat(tr(
"FrameBorderSize"), &style.FrameBorderSize, 0.0f,
1075 ImGui::SliderFloat(tr(
"TabBorderSize"), &style.TabBorderSize, 0.0f, 1.0f,
1077 ImGui::SliderFloat(tr(
"TabBarBorderSize"), &style.TabBarBorderSize, 0.0f,
1080 ImGui::SeparatorText(tr(
"Rounding"));
1081 ImGui::SliderFloat(tr(
"WindowRounding"), &style.WindowRounding, 0.0f,
1083 ImGui::SliderFloat(tr(
"ChildRounding"), &style.ChildRounding, 0.0f, 12.0f,
1085 ImGui::SliderFloat(tr(
"FrameRounding"), &style.FrameRounding, 0.0f, 12.0f,
1087 ImGui::SliderFloat(tr(
"PopupRounding"), &style.PopupRounding, 0.0f, 12.0f,
1089 ImGui::SliderFloat(tr(
"ScrollbarRounding"), &style.ScrollbarRounding,
1090 0.0f, 12.0f,
"%.0f");
1091 ImGui::SliderFloat(tr(
"GrabRounding"), &style.GrabRounding, 0.0f, 12.0f,
1093 ImGui::SliderFloat(tr(
"TabRounding"), &style.TabRounding, 0.0f, 12.0f,
1096 ImGui::SeparatorText(tr(
"Tables"));
1097 ImGui::SliderFloat2(
"CellPadding", (
float*)&style.CellPadding, 0.0f,
1099 ImGui::SliderAngle(
"TableAngledHeadersAngle",
1100 &style.TableAngledHeadersAngle, -50.0f, +50.0f);
1102 ImGui::SeparatorText(tr(
"Widgets"));
1103 ImGui::SliderFloat2(
"WindowTitleAlign", (
float*)&style.WindowTitleAlign,
1104 0.0f, 1.0f,
"%.2f");
1105 ImGui::Combo(tr(
"ColorButtonPosition"), (
int*)&style.ColorButtonPosition,
1107 ImGui::SliderFloat2(
"ButtonTextAlign", (
float*)&style.ButtonTextAlign,
1108 0.0f, 1.0f,
"%.2f");
1111 ImGui::SliderFloat2(
"SelectableTextAlign",
1112 (
float*)&style.SelectableTextAlign, 0.0f, 1.0f,
1116 ImGui::SliderFloat(tr(
"SeparatorTextBorderSize"),
1117 &style.SeparatorTextBorderSize, 0.0f, 10.0f,
"%.0f");
1118 ImGui::SliderFloat2(
"SeparatorTextAlign",
1119 (
float*)&style.SeparatorTextAlign, 0.0f, 1.0f,
1121 ImGui::SliderFloat2(
"SeparatorTextPadding",
1122 (
float*)&style.SeparatorTextPadding, 0.0f, 40.0f,
1124 ImGui::SliderFloat(tr(
"LogSliderDeadzone"), &style.LogSliderDeadzone,
1125 0.0f, 12.0f,
"%.0f");
1127 ImGui::SeparatorText(tr(
"Tooltips"));
1128 for (
int n = 0; n < 2; n++)
1129 if (ImGui::TreeNodeEx(n == 0 ?
"HoverFlagsForTooltipMouse"
1130 :
"HoverFlagsForTooltipNav")) {
1131 ImGuiHoveredFlags* p = (n == 0) ? &style.HoverFlagsForTooltipMouse
1132 : &style.HoverFlagsForTooltipNav;
1133 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNone", p,
1134 ImGuiHoveredFlags_DelayNone);
1135 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayShort", p,
1136 ImGuiHoveredFlags_DelayShort);
1137 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNormal", p,
1138 ImGuiHoveredFlags_DelayNormal);
1139 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_Stationary", p,
1140 ImGuiHoveredFlags_Stationary);
1141 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_NoSharedDelay", p,
1142 ImGuiHoveredFlags_NoSharedDelay);
1146 ImGui::SeparatorText(tr(
"Misc"));
1147 ImGui::SliderFloat2(
"DisplaySafeAreaPadding",
1148 (
float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f,
1152 ImGui::EndTabItem();
1155 if (ImGui::BeginTabItem(tr(
"Colors"))) {
1156 static int output_dest = 0;
1157 static bool output_only_modified =
true;
1158 if (ImGui::Button(tr(
"Export"))) {
1159 if (output_dest == 0)
1160 ImGui::LogToClipboard();
1163 ImGui::LogText(
"ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
1164 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
1165 const ImVec4& col = style.Colors[i];
1166 const char* name = ImGui::GetStyleColorName(i);
1167 if (!output_only_modified ||
1168 memcmp(&col, &ref->Colors[i],
sizeof(ImVec4)) != 0)
1170 "colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, "
1171 "%.2ff);" IM_NEWLINE,
1172 name, 23 - (
int)strlen(name),
"", col.x, col.y, col.z, col.w);
1177 ImGui::SetNextItemWidth(120);
1178 ImGui::Combo(
"##output_type", &output_dest,
"To Clipboard\0To TTY\0");
1180 ImGui::Checkbox(tr(
"Only Modified Colors"), &output_only_modified);
1182 static ImGuiTextFilter filter;
1183 filter.Draw(
"Filter colors", ImGui::GetFontSize() * 16);
1185 static ImGuiColorEditFlags alpha_flags = 0;
1186 if (ImGui::RadioButton(tr(
"Opaque"),
1187 alpha_flags == ImGuiColorEditFlags_None)) {
1188 alpha_flags = ImGuiColorEditFlags_None;
1191 if (ImGui::RadioButton(tr(
"Alpha"),
1192 alpha_flags == ImGuiColorEditFlags_AlphaPreview)) {
1193 alpha_flags = ImGuiColorEditFlags_AlphaPreview;
1196 if (ImGui::RadioButton(
1198 alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) {
1199 alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf;
1203 ImGui::SetNextWindowSizeConstraints(
1204 ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 10),
1205 ImVec2(FLT_MAX, FLT_MAX));
1206 ImGui::BeginChild(
"##colors", ImVec2(0, 0),
1207 ImGuiChildFlags_Borders | ImGuiChildFlags_NavFlattened,
1208 ImGuiWindowFlags_AlwaysVerticalScrollbar |
1209 ImGuiWindowFlags_AlwaysHorizontalScrollbar);
1210 ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
1211 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
1212 const char* name = ImGui::GetStyleColorName(i);
1213 if (!filter.PassFilter(name))
1216 ImGui::ColorEdit4(
"##color", (
float*)&style.Colors[i],
1217 ImGuiColorEditFlags_AlphaBar | alpha_flags);
1218 if (memcmp(&style.Colors[i], &ref->Colors[i],
sizeof(ImVec4)) != 0) {
1223 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
1224 if (ImGui::Button(tr(
"Save"))) {
1225 ref->Colors[i] = style.Colors[i];
1227 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
1228 if (ImGui::Button(tr(
"Revert"))) {
1229 style.Colors[i] = ref->Colors[i];
1232 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
1233 ImGui::TextUnformatted(name);
1236 ImGui::PopItemWidth();
1239 ImGui::EndTabItem();
1242 if (ImGui::BeginTabItem(tr(
"Fonts"))) {
1243 ImGuiIO& io = ImGui::GetIO();
1244 ImFontAtlas* atlas = io.Fonts;
1245 ImGui::ShowFontAtlas(atlas);
1251 const float MIN_SCALE = 0.3f;
1252 const float MAX_SCALE = 2.0f;
1254 static float window_scale = 1.0f;
1255 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
1256 if (ImGui::DragFloat(
1257 tr(
"window scale"), &window_scale, 0.005f, MIN_SCALE, MAX_SCALE,
1259 ImGuiSliderFlags_AlwaysClamp))
1260 ImGui::SetWindowFontScale(window_scale);
1263 ImGui::PopItemWidth();
1265 ImGui::EndTabItem();
1268 if (ImGui::BeginTabItem(tr(
"Rendering"))) {
1269 ImGui::Checkbox(tr(
"Anti-aliased lines"), &style.AntiAliasedLines);
1272 ImGui::Checkbox(tr(
"Anti-aliased lines use texture"),
1273 &style.AntiAliasedLinesUseTex);
1276 ImGui::Checkbox(tr(
"Anti-aliased fill"), &style.AntiAliasedFill);
1277 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
1278 ImGui::DragFloat(tr(
"Curve Tessellation Tolerance"),
1279 &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f,
1281 if (style.CurveTessellationTol < 0.10f)
1282 style.CurveTessellationTol = 0.10f;
1286 ImGui::DragFloat(tr(
"Circle Tessellation Max Error"),
1287 &style.CircleTessellationMaxError, 0.005f, 0.10f, 5.0f,
1288 "%.2f", ImGuiSliderFlags_AlwaysClamp);
1289 const bool show_samples = ImGui::IsItemActive();
1291 ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
1292 if (show_samples && ImGui::BeginTooltip()) {
1293 ImGui::TextUnformatted(tr(
"(R = radius, N = number of segments)"));
1295 ImDrawList* draw_list = ImGui::GetWindowDrawList();
1296 const float min_widget_width = ImGui::CalcTextSize(
"N: MMM\nR: MMM").x;
1297 for (
int n = 0; n < 8; n++) {
1298 const float RAD_MIN = 5.0f;
1299 const float RAD_MAX = 70.0f;
1301 RAD_MIN + (RAD_MAX - RAD_MIN) * (
float)n / (8.0f - 1.0f);
1303 ImGui::BeginGroup();
1305 ImGui::Text(tr(
"R: %.f\nN: %d"), rad,
1306 draw_list->_CalcCircleAutoSegmentCount(rad));
1308 const float canvas_width = std::max(min_widget_width, rad * 2.0f);
1309 const float offset_x = floorf(canvas_width * 0.5f);
1310 const float offset_y = floorf(RAD_MAX);
1312 const ImVec2 p1 = ImGui::GetCursorScreenPos();
1313 draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad,
1314 ImGui::GetColorU32(ImGuiCol_Text));
1315 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
1320 ImGui::EndTooltip();
1324 ImGui::DragFloat(tr(
"Global Alpha"), &style.Alpha, 0.005f, 0.20f, 1.0f,
1329 ImGui::DragFloat(tr(
"Disabled Alpha"), &style.DisabledAlpha, 0.005f, 0.0f,
1333 ImGui::PopItemWidth();
1335 ImGui::EndTabItem();
1341 ImGui::PopItemWidth();