64 ImGuiStyle &style = ImGui::GetStyle();
65 static ImGuiStyle ref_saved_style;
68 static bool init =
true;
69 if (init && ref == NULL)
70 ref_saved_style = style;
73 ref = &ref_saved_style;
75 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
77 if (ImGui::ShowStyleSelector(
"Colors##Selector"))
78 ref_saved_style = style;
79 ImGui::ShowFontSelector(
"Fonts##Selector");
83 if (ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
85 style.GrabRounding = style.FrameRounding;
88 bool border = (style.WindowBorderSize > 0.0f);
89 if (ImGui::Checkbox(
"WindowBorder", &border)) {
90 style.WindowBorderSize = border ? 1.0f : 0.0f;
95 bool border = (style.FrameBorderSize > 0.0f);
96 if (ImGui::Checkbox(
"FrameBorder", &border)) {
97 style.FrameBorderSize = border ? 1.0f : 0.0f;
102 bool border = (style.PopupBorderSize > 0.0f);
103 if (ImGui::Checkbox(
"PopupBorder", &border)) {
104 style.PopupBorderSize = border ? 1.0f : 0.0f;
109 if (ImGui::Button(
"Save Ref"))
110 *ref = ref_saved_style = style;
112 if (ImGui::Button(
"Revert Ref"))
118 if (ImGui::BeginTabBar(
"##tabs", ImGuiTabBarFlags_None)) {
119 if (ImGui::BeginTabItem(
"Sizes")) {
120 ImGui::SeparatorText(
"Main");
121 ImGui::SliderFloat2(
"WindowPadding", (
float *)&style.WindowPadding, 0.0f,
123 ImGui::SliderFloat2(
"FramePadding", (
float *)&style.FramePadding, 0.0f,
125 ImGui::SliderFloat2(
"ItemSpacing", (
float *)&style.ItemSpacing, 0.0f,
127 ImGui::SliderFloat2(
"ItemInnerSpacing", (
float *)&style.ItemInnerSpacing,
128 0.0f, 20.0f,
"%.0f");
129 ImGui::SliderFloat2(
"TouchExtraPadding",
130 (
float *)&style.TouchExtraPadding, 0.0f, 10.0f,
132 ImGui::SliderFloat(
"IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f,
134 ImGui::SliderFloat(
"ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f,
136 ImGui::SliderFloat(
"GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f,
139 ImGui::SeparatorText(
"Borders");
140 ImGui::SliderFloat(
"WindowBorderSize", &style.WindowBorderSize, 0.0f,
142 ImGui::SliderFloat(
"ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f,
144 ImGui::SliderFloat(
"PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f,
146 ImGui::SliderFloat(
"FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f,
148 ImGui::SliderFloat(
"TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f,
150 ImGui::SliderFloat(
"TabBarBorderSize", &style.TabBarBorderSize, 0.0f,
153 ImGui::SeparatorText(
"Rounding");
154 ImGui::SliderFloat(
"WindowRounding", &style.WindowRounding, 0.0f, 12.0f,
156 ImGui::SliderFloat(
"ChildRounding", &style.ChildRounding, 0.0f, 12.0f,
158 ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
160 ImGui::SliderFloat(
"PopupRounding", &style.PopupRounding, 0.0f, 12.0f,
162 ImGui::SliderFloat(
"ScrollbarRounding", &style.ScrollbarRounding, 0.0f,
164 ImGui::SliderFloat(
"GrabRounding", &style.GrabRounding, 0.0f, 12.0f,
166 ImGui::SliderFloat(
"TabRounding", &style.TabRounding, 0.0f, 12.0f,
169 ImGui::SeparatorText(
"Tables");
170 ImGui::SliderFloat2(
"CellPadding", (
float *)&style.CellPadding, 0.0f,
172 ImGui::SliderAngle(
"TableAngledHeadersAngle",
173 &style.TableAngledHeadersAngle, -50.0f, +50.0f);
175 ImGui::SeparatorText(
"Widgets");
176 ImGui::SliderFloat2(
"WindowTitleAlign", (
float *)&style.WindowTitleAlign,
178 ImGui::Combo(
"ColorButtonPosition", (
int *)&style.ColorButtonPosition,
180 ImGui::SliderFloat2(
"ButtonTextAlign", (
float *)&style.ButtonTextAlign,
184 ImGui::SliderFloat2(
"SelectableTextAlign",
185 (
float *)&style.SelectableTextAlign, 0.0f, 1.0f,
189 ImGui::SliderFloat(
"SeparatorTextBorderSize",
190 &style.SeparatorTextBorderSize, 0.0f, 10.0f,
"%.0f");
191 ImGui::SliderFloat2(
"SeparatorTextAlign",
192 (
float *)&style.SeparatorTextAlign, 0.0f, 1.0f,
194 ImGui::SliderFloat2(
"SeparatorTextPadding",
195 (
float *)&style.SeparatorTextPadding, 0.0f, 40.0f,
197 ImGui::SliderFloat(
"LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f,
200 ImGui::SeparatorText(
"Tooltips");
201 for (
int n = 0; n < 2; n++)
202 if (ImGui::TreeNodeEx(n == 0 ?
"HoverFlagsForTooltipMouse"
203 :
"HoverFlagsForTooltipNav")) {
204 ImGuiHoveredFlags *p = (n == 0) ? &style.HoverFlagsForTooltipMouse
205 : &style.HoverFlagsForTooltipNav;
206 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNone", p,
207 ImGuiHoveredFlags_DelayNone);
208 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayShort", p,
209 ImGuiHoveredFlags_DelayShort);
210 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNormal", p,
211 ImGuiHoveredFlags_DelayNormal);
212 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_Stationary", p,
213 ImGuiHoveredFlags_Stationary);
214 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_NoSharedDelay", p,
215 ImGuiHoveredFlags_NoSharedDelay);
219 ImGui::SeparatorText(
"Misc");
220 ImGui::SliderFloat2(
"DisplaySafeAreaPadding",
221 (
float *)&style.DisplaySafeAreaPadding, 0.0f, 30.0f,
228 if (ImGui::BeginTabItem(
"Colors")) {
229 static int output_dest = 0;
230 static bool output_only_modified =
true;
231 if (ImGui::Button(
"Export")) {
232 if (output_dest == 0)
233 ImGui::LogToClipboard();
236 ImGui::LogText(
"ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
237 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
238 const ImVec4 &col = style.Colors[i];
239 const char *name = ImGui::GetStyleColorName(i);
240 if (!output_only_modified ||
241 memcmp(&col, &ref->Colors[i],
sizeof(ImVec4)) != 0)
243 "colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, "
244 "%.2ff);" IM_NEWLINE,
245 name, 23 - (
int)strlen(name),
"", col.x, col.y, col.z, col.w);
250 ImGui::SetNextItemWidth(120);
251 ImGui::Combo(
"##output_type", &output_dest,
"To Clipboard\0To TTY\0");
253 ImGui::Checkbox(
"Only Modified Colors", &output_only_modified);
255 static ImGuiTextFilter filter;
256 filter.Draw(
"Filter colors", ImGui::GetFontSize() * 16);
258 static ImGuiColorEditFlags alpha_flags = 0;
259 if (ImGui::RadioButton(
"Opaque",
260 alpha_flags == ImGuiColorEditFlags_None)) {
261 alpha_flags = ImGuiColorEditFlags_None;
264 if (ImGui::RadioButton(
"Alpha",
265 alpha_flags == ImGuiColorEditFlags_AlphaPreview)) {
266 alpha_flags = ImGuiColorEditFlags_AlphaPreview;
269 if (ImGui::RadioButton(
270 "Both", alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) {
271 alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf;
275 ImGui::SetNextWindowSizeConstraints(
276 ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 10),
277 ImVec2(FLT_MAX, FLT_MAX));
278 ImGui::BeginChild(
"##colors", ImVec2(0, 0), ImGuiChildFlags_Border,
279 ImGuiWindowFlags_AlwaysVerticalScrollbar |
280 ImGuiWindowFlags_AlwaysHorizontalScrollbar |
281 ImGuiWindowFlags_NavFlattened);
282 ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
283 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
284 const char *name = ImGui::GetStyleColorName(i);
285 if (!filter.PassFilter(name))
288 ImGui::ColorEdit4(
"##color", (
float *)&style.Colors[i],
289 ImGuiColorEditFlags_AlphaBar | alpha_flags);
290 if (memcmp(&style.Colors[i], &ref->Colors[i],
sizeof(ImVec4)) != 0) {
295 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
296 if (ImGui::Button(
"Save")) {
297 ref->Colors[i] = style.Colors[i];
299 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
300 if (ImGui::Button(
"Revert")) {
301 style.Colors[i] = ref->Colors[i];
304 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
305 ImGui::TextUnformatted(name);
308 ImGui::PopItemWidth();
314 if (ImGui::BeginTabItem(
"Fonts")) {
315 ImGuiIO &io = ImGui::GetIO();
316 ImFontAtlas *atlas = io.Fonts;
317 ImGui::ShowFontAtlas(atlas);
323 const float MIN_SCALE = 0.3f;
324 const float MAX_SCALE = 2.0f;
326 static float window_scale = 1.0f;
327 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
328 if (ImGui::DragFloat(
329 "window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE,
331 ImGuiSliderFlags_AlwaysClamp))
332 ImGui::SetWindowFontScale(window_scale);
333 ImGui::DragFloat(
"global scale", &io.FontGlobalScale, 0.005f, MIN_SCALE,
335 ImGuiSliderFlags_AlwaysClamp);
336 ImGui::PopItemWidth();
341 if (ImGui::BeginTabItem(
"Rendering")) {
342 ImGui::Checkbox(
"Anti-aliased lines", &style.AntiAliasedLines);
345 ImGui::Checkbox(
"Anti-aliased lines use texture",
346 &style.AntiAliasedLinesUseTex);
349 ImGui::Checkbox(
"Anti-aliased fill", &style.AntiAliasedFill);
350 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
351 ImGui::DragFloat(
"Curve Tessellation Tolerance",
352 &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f,
354 if (style.CurveTessellationTol < 0.10f)
355 style.CurveTessellationTol = 0.10f;
359 ImGui::DragFloat(
"Circle Tessellation Max Error",
360 &style.CircleTessellationMaxError, 0.005f, 0.10f, 5.0f,
361 "%.2f", ImGuiSliderFlags_AlwaysClamp);
362 const bool show_samples = ImGui::IsItemActive();
364 ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
365 if (show_samples && ImGui::BeginTooltip()) {
366 ImGui::TextUnformatted(
"(R = radius, N = number of segments)");
368 ImDrawList *draw_list = ImGui::GetWindowDrawList();
369 const float min_widget_width = ImGui::CalcTextSize(
"N: MMM\nR: MMM").x;
370 for (
int n = 0; n < 8; n++) {
371 const float RAD_MIN = 5.0f;
372 const float RAD_MAX = 70.0f;
374 RAD_MIN + (RAD_MAX - RAD_MIN) * (
float)n / (8.0f - 1.0f);
378 ImGui::Text(
"R: %.f\nN: %d", rad,
379 draw_list->_CalcCircleAutoSegmentCount(rad));
381 const float canvas_width = std::max(min_widget_width, rad * 2.0f);
382 const float offset_x = floorf(canvas_width * 0.5f);
383 const float offset_y = floorf(RAD_MAX);
385 const ImVec2 p1 = ImGui::GetCursorScreenPos();
386 draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad,
387 ImGui::GetColorU32(ImGuiCol_Text));
388 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
404 ImGui::DragFloat(
"Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f,
409 ImGui::DragFloat(
"Disabled Alpha", &style.DisabledAlpha, 0.005f, 0.0f,
413 ImGui::PopItemWidth();
421 ImGui::PopItemWidth();
432 ImGuiStyle *style = &ImGui::GetStyle();
433 ImVec4 *colors = style->Colors;
435 style->WindowPadding = ImVec2(10.f, 10.f);
436 style->FramePadding = ImVec2(10.f, 2.f);
437 style->CellPadding = ImVec2(4.f, 5.f);
438 style->ItemSpacing = ImVec2(10.f, 5.f);
439 style->ItemInnerSpacing = ImVec2(5.f, 5.f);
440 style->TouchExtraPadding = ImVec2(0.f, 0.f);
441 style->IndentSpacing = 20.f;
442 style->ScrollbarSize = 14.f;
443 style->GrabMinSize = 15.f;
445 style->WindowBorderSize = 0.f;
446 style->ChildBorderSize = 1.f;
447 style->PopupBorderSize = 1.f;
448 style->FrameBorderSize = 0.f;
449 style->TabBorderSize = 0.f;
451 style->WindowRounding = 0.f;
452 style->ChildRounding = 0.f;
453 style->FrameRounding = 5.f;
454 style->PopupRounding = 0.f;
455 style->ScrollbarRounding = 5.f;
457 auto alttpDarkGreen = ImVec4(0.18f, 0.26f, 0.18f, 1.0f);
458 auto alttpMidGreen = ImVec4(0.28f, 0.36f, 0.28f, 1.0f);
459 auto allttpLightGreen = ImVec4(0.36f, 0.45f, 0.36f, 1.0f);
460 auto allttpLightestGreen = ImVec4(0.49f, 0.57f, 0.49f, 1.0f);
462 colors[ImGuiCol_MenuBarBg] = alttpDarkGreen;
463 colors[ImGuiCol_TitleBg] = alttpMidGreen;
465 colors[ImGuiCol_Header] = alttpDarkGreen;
466 colors[ImGuiCol_HeaderHovered] = allttpLightGreen;
467 colors[ImGuiCol_HeaderActive] = alttpMidGreen;
469 colors[ImGuiCol_TitleBgActive] = alttpDarkGreen;
470 colors[ImGuiCol_TitleBgCollapsed] = alttpMidGreen;
472 colors[ImGuiCol_Tab] = alttpDarkGreen;
473 colors[ImGuiCol_TabHovered] = alttpMidGreen;
474 colors[ImGuiCol_TabActive] = ImVec4(0.347f, 0.466f, 0.347f, 1.000f);
476 colors[ImGuiCol_Button] = alttpMidGreen;
477 colors[ImGuiCol_ButtonHovered] = allttpLightestGreen;
478 colors[ImGuiCol_ButtonActive] = allttpLightGreen;
480 colors[ImGuiCol_ScrollbarBg] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
481 colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.36f, 0.45f, 0.36f, 0.30f);
482 colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.36f, 0.45f, 0.36f, 0.40f);
483 colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
485 colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
486 colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
487 colors[ImGuiCol_WindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.85f);
488 colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
489 colors[ImGuiCol_PopupBg] = ImVec4(0.11f, 0.11f, 0.14f, 0.92f);
490 colors[ImGuiCol_Border] = allttpLightGreen;
491 colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
493 colors[ImGuiCol_FrameBg] = ImVec4(0.43f, 0.43f, 0.43f, 0.39f);
494 colors[ImGuiCol_FrameBgHovered] = ImVec4(0.28f, 0.36f, 0.28f, 0.40f);
495 colors[ImGuiCol_FrameBgActive] = ImVec4(0.28f, 0.36f, 0.28f, 0.69f);
497 colors[ImGuiCol_CheckMark] = ImVec4(0.90f, 0.90f, 0.90f, 0.50f);
498 colors[ImGuiCol_SliderGrab] = ImVec4(1.00f, 1.00f, 1.00f, 0.30f);
499 colors[ImGuiCol_SliderGrabActive] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
501 colors[ImGuiCol_Separator] = ImVec4(0.50f, 0.50f, 0.50f, 0.60f);
502 colors[ImGuiCol_SeparatorHovered] = ImVec4(0.60f, 0.60f, 0.70f, 1.00f);
503 colors[ImGuiCol_SeparatorActive] = ImVec4(0.70f, 0.70f, 0.90f, 1.00f);
504 colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 0.10f);
505 colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.78f, 0.82f, 1.00f, 0.60f);
506 colors[ImGuiCol_ResizeGripActive] = ImVec4(0.78f, 0.82f, 1.00f, 0.90f);
508 colors[ImGuiCol_TabUnfocused] =
509 ImLerp(colors[ImGuiCol_Tab], colors[ImGuiCol_TitleBg], 0.80f);
510 colors[ImGuiCol_TabUnfocusedActive] =
511 ImLerp(colors[ImGuiCol_TabActive], colors[ImGuiCol_TitleBg], 0.40f);
512 colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
513 colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
514 colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
515 colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
516 colors[ImGuiCol_TableHeaderBg] = alttpDarkGreen;
517 colors[ImGuiCol_TableBorderStrong] = alttpMidGreen;
518 colors[ImGuiCol_TableBorderLight] =
519 ImVec4(0.26f, 0.26f, 0.28f, 1.00f);
520 colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
521 colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.07f);
522 colors[ImGuiCol_TextSelectedBg] = ImVec4(0.00f, 0.00f, 1.00f, 0.35f);
523 colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
524 colors[ImGuiCol_NavHighlight] = colors[ImGuiCol_HeaderHovered];
525 colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
526 colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
527 colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
597 TextEditor::LanguageDefinition language_65816;
598 for (
auto &k : kKeywords)
599 language_65816.mKeywords.emplace(k);
601 for (
auto &k : kIdentifiers) {
602 TextEditor::Identifier id;
603 id.mDeclaration =
"Built-in function";
604 language_65816.mIdentifiers.insert(std::make_pair(std::string(k),
id));
607 language_65816.mTokenRegexStrings.push_back(
608 std::make_pair<std::string, TextEditor::PaletteIndex>(
609 "[ \\t]*#[ \\t]*[a-zA-Z_]+", TextEditor::PaletteIndex::Preprocessor));
610 language_65816.mTokenRegexStrings.push_back(
611 std::make_pair<std::string, TextEditor::PaletteIndex>(
612 "L?\\\"(\\\\.|[^\\\"])*\\\"", TextEditor::PaletteIndex::String));
613 language_65816.mTokenRegexStrings.push_back(
614 std::make_pair<std::string, TextEditor::PaletteIndex>(
615 "\\'\\\\?[^\\']\\'", TextEditor::PaletteIndex::CharLiteral));
616 language_65816.mTokenRegexStrings.push_back(
617 std::make_pair<std::string, TextEditor::PaletteIndex>(
618 "[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)([eE][+-]?[0-9]+)?[fF]?",
619 TextEditor::PaletteIndex::Number));
620 language_65816.mTokenRegexStrings.push_back(
621 std::make_pair<std::string, TextEditor::PaletteIndex>(
622 "[+-]?[0-9]+[Uu]?[lL]?[lL]?", TextEditor::PaletteIndex::Number));
623 language_65816.mTokenRegexStrings.push_back(
624 std::make_pair<std::string, TextEditor::PaletteIndex>(
625 "0[0-7]+[Uu]?[lL]?[lL]?", TextEditor::PaletteIndex::Number));
626 language_65816.mTokenRegexStrings.push_back(
627 std::make_pair<std::string, TextEditor::PaletteIndex>(
628 "0[xX][0-9a-fA-F]+[uU]?[lL]?[lL]?",
629 TextEditor::PaletteIndex::Number));
630 language_65816.mTokenRegexStrings.push_back(
631 std::make_pair<std::string, TextEditor::PaletteIndex>(
632 "[a-zA-Z_][a-zA-Z0-9_]*", TextEditor::PaletteIndex::Identifier));
633 language_65816.mTokenRegexStrings.push_back(
634 std::make_pair<std::string, TextEditor::PaletteIndex>(
635 "[\\[\\]\\{\\}\\!\\%\\^\\&\\*\\(\\)\\-\\+\\=\\~\\|\\<\\>\\?\\/"
637 TextEditor::PaletteIndex::Punctuation));
639 language_65816.mCommentStart =
"/*";
640 language_65816.mCommentEnd =
"*/";
641 language_65816.mSingleLineComment =
";";
643 language_65816.mCaseSensitive =
false;
644 language_65816.mAutoIndentation =
true;
646 language_65816.mName =
"65816";
648 return language_65816;