64 ImGuiStyle& style = ImGui::GetStyle();
65 static ImGuiStyle ref_saved_style;
68 static bool init =
true;
69 if (init && ref == NULL) ref_saved_style = style;
71 if (ref == NULL) ref = &ref_saved_style;
73 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
75 if (ImGui::ShowStyleSelector(
"Colors##Selector")) ref_saved_style = style;
76 ImGui::ShowFontSelector(
"Fonts##Selector");
80 if (ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
82 style.GrabRounding = style.FrameRounding;
85 bool border = (style.WindowBorderSize > 0.0f);
86 if (ImGui::Checkbox(
"WindowBorder", &border)) {
87 style.WindowBorderSize = border ? 1.0f : 0.0f;
92 bool border = (style.FrameBorderSize > 0.0f);
93 if (ImGui::Checkbox(
"FrameBorder", &border)) {
94 style.FrameBorderSize = border ? 1.0f : 0.0f;
99 bool border = (style.PopupBorderSize > 0.0f);
100 if (ImGui::Checkbox(
"PopupBorder", &border)) {
101 style.PopupBorderSize = border ? 1.0f : 0.0f;
106 if (ImGui::Button(
"Save Ref")) *ref = ref_saved_style = style;
108 if (ImGui::Button(
"Revert Ref")) style = *ref;
113 if (ImGui::BeginTabBar(
"##tabs", ImGuiTabBarFlags_None)) {
114 if (ImGui::BeginTabItem(
"Sizes")) {
115 ImGui::SeparatorText(
"Main");
116 ImGui::SliderFloat2(
"WindowPadding", (
float*)&style.WindowPadding, 0.0f,
118 ImGui::SliderFloat2(
"FramePadding", (
float*)&style.FramePadding, 0.0f,
120 ImGui::SliderFloat2(
"ItemSpacing", (
float*)&style.ItemSpacing, 0.0f,
122 ImGui::SliderFloat2(
"ItemInnerSpacing", (
float*)&style.ItemInnerSpacing,
123 0.0f, 20.0f,
"%.0f");
124 ImGui::SliderFloat2(
"TouchExtraPadding", (
float*)&style.TouchExtraPadding,
125 0.0f, 10.0f,
"%.0f");
126 ImGui::SliderFloat(
"IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f,
128 ImGui::SliderFloat(
"ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f,
130 ImGui::SliderFloat(
"GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f,
133 ImGui::SeparatorText(
"Borders");
134 ImGui::SliderFloat(
"WindowBorderSize", &style.WindowBorderSize, 0.0f,
136 ImGui::SliderFloat(
"ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f,
138 ImGui::SliderFloat(
"PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f,
140 ImGui::SliderFloat(
"FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f,
142 ImGui::SliderFloat(
"TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f,
144 ImGui::SliderFloat(
"TabBarBorderSize", &style.TabBarBorderSize, 0.0f,
147 ImGui::SeparatorText(
"Rounding");
148 ImGui::SliderFloat(
"WindowRounding", &style.WindowRounding, 0.0f, 12.0f,
150 ImGui::SliderFloat(
"ChildRounding", &style.ChildRounding, 0.0f, 12.0f,
152 ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
154 ImGui::SliderFloat(
"PopupRounding", &style.PopupRounding, 0.0f, 12.0f,
156 ImGui::SliderFloat(
"ScrollbarRounding", &style.ScrollbarRounding, 0.0f,
158 ImGui::SliderFloat(
"GrabRounding", &style.GrabRounding, 0.0f, 12.0f,
160 ImGui::SliderFloat(
"TabRounding", &style.TabRounding, 0.0f, 12.0f,
163 ImGui::SeparatorText(
"Tables");
164 ImGui::SliderFloat2(
"CellPadding", (
float*)&style.CellPadding, 0.0f,
166 ImGui::SliderAngle(
"TableAngledHeadersAngle",
167 &style.TableAngledHeadersAngle, -50.0f, +50.0f);
169 ImGui::SeparatorText(
"Widgets");
170 ImGui::SliderFloat2(
"WindowTitleAlign", (
float*)&style.WindowTitleAlign,
172 ImGui::Combo(
"ColorButtonPosition", (
int*)&style.ColorButtonPosition,
174 ImGui::SliderFloat2(
"ButtonTextAlign", (
float*)&style.ButtonTextAlign,
178 ImGui::SliderFloat2(
"SelectableTextAlign",
179 (
float*)&style.SelectableTextAlign, 0.0f, 1.0f,
183 ImGui::SliderFloat(
"SeparatorTextBorderSize",
184 &style.SeparatorTextBorderSize, 0.0f, 10.0f,
"%.0f");
185 ImGui::SliderFloat2(
"SeparatorTextAlign",
186 (
float*)&style.SeparatorTextAlign, 0.0f, 1.0f,
188 ImGui::SliderFloat2(
"SeparatorTextPadding",
189 (
float*)&style.SeparatorTextPadding, 0.0f, 40.0f,
191 ImGui::SliderFloat(
"LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f,
194 ImGui::SeparatorText(
"Tooltips");
195 for (
int n = 0; n < 2; n++)
196 if (ImGui::TreeNodeEx(n == 0 ?
"HoverFlagsForTooltipMouse"
197 :
"HoverFlagsForTooltipNav")) {
198 ImGuiHoveredFlags* p = (n == 0) ? &style.HoverFlagsForTooltipMouse
199 : &style.HoverFlagsForTooltipNav;
200 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNone", p,
201 ImGuiHoveredFlags_DelayNone);
202 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayShort", p,
203 ImGuiHoveredFlags_DelayShort);
204 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNormal", p,
205 ImGuiHoveredFlags_DelayNormal);
206 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_Stationary", p,
207 ImGuiHoveredFlags_Stationary);
208 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_NoSharedDelay", p,
209 ImGuiHoveredFlags_NoSharedDelay);
213 ImGui::SeparatorText(
"Misc");
214 ImGui::SliderFloat2(
"DisplaySafeAreaPadding",
215 (
float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f,
222 if (ImGui::BeginTabItem(
"Colors")) {
223 static int output_dest = 0;
224 static bool output_only_modified =
true;
225 if (ImGui::Button(
"Export")) {
226 if (output_dest == 0)
227 ImGui::LogToClipboard();
230 ImGui::LogText(
"ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
231 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
232 const ImVec4& col = style.Colors[i];
233 const char* name = ImGui::GetStyleColorName(i);
234 if (!output_only_modified ||
235 memcmp(&col, &ref->Colors[i],
sizeof(ImVec4)) != 0)
237 "colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, "
238 "%.2ff);" IM_NEWLINE,
239 name, 23 - (
int)strlen(name),
"", col.x, col.y, col.z, col.w);
244 ImGui::SetNextItemWidth(120);
245 ImGui::Combo(
"##output_type", &output_dest,
"To Clipboard\0To TTY\0");
247 ImGui::Checkbox(
"Only Modified Colors", &output_only_modified);
249 static ImGuiTextFilter filter;
250 filter.Draw(
"Filter colors", ImGui::GetFontSize() * 16);
252 static ImGuiColorEditFlags alpha_flags = 0;
253 if (ImGui::RadioButton(
"Opaque",
254 alpha_flags == ImGuiColorEditFlags_None)) {
255 alpha_flags = ImGuiColorEditFlags_None;
258 if (ImGui::RadioButton(
"Alpha",
259 alpha_flags == ImGuiColorEditFlags_AlphaPreview)) {
260 alpha_flags = ImGuiColorEditFlags_AlphaPreview;
263 if (ImGui::RadioButton(
264 "Both", alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) {
265 alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf;
269 ImGui::SetNextWindowSizeConstraints(
270 ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 10),
271 ImVec2(FLT_MAX, FLT_MAX));
272 ImGui::BeginChild(
"##colors", ImVec2(0, 0), ImGuiChildFlags_Border,
273 ImGuiWindowFlags_AlwaysVerticalScrollbar |
274 ImGuiWindowFlags_AlwaysHorizontalScrollbar |
275 ImGuiWindowFlags_NavFlattened);
276 ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
277 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
278 const char* name = ImGui::GetStyleColorName(i);
279 if (!filter.PassFilter(name))
continue;
281 ImGui::ColorEdit4(
"##color", (
float*)&style.Colors[i],
282 ImGuiColorEditFlags_AlphaBar | alpha_flags);
283 if (memcmp(&style.Colors[i], &ref->Colors[i],
sizeof(ImVec4)) != 0) {
288 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
289 if (ImGui::Button(
"Save")) {
290 ref->Colors[i] = style.Colors[i];
292 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
293 if (ImGui::Button(
"Revert")) {
294 style.Colors[i] = ref->Colors[i];
297 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
298 ImGui::TextUnformatted(name);
301 ImGui::PopItemWidth();
307 if (ImGui::BeginTabItem(
"Fonts")) {
308 ImGuiIO& io = ImGui::GetIO();
309 ImFontAtlas* atlas = io.Fonts;
310 ImGui::ShowFontAtlas(atlas);
316 const float MIN_SCALE = 0.3f;
317 const float MAX_SCALE = 2.0f;
319 static float window_scale = 1.0f;
320 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
321 if (ImGui::DragFloat(
322 "window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE,
324 ImGuiSliderFlags_AlwaysClamp))
325 ImGui::SetWindowFontScale(window_scale);
326 ImGui::DragFloat(
"global scale", &io.FontGlobalScale, 0.005f, MIN_SCALE,
328 ImGuiSliderFlags_AlwaysClamp);
329 ImGui::PopItemWidth();
334 if (ImGui::BeginTabItem(
"Rendering")) {
335 ImGui::Checkbox(
"Anti-aliased lines", &style.AntiAliasedLines);
338 ImGui::Checkbox(
"Anti-aliased lines use texture",
339 &style.AntiAliasedLinesUseTex);
342 ImGui::Checkbox(
"Anti-aliased fill", &style.AntiAliasedFill);
343 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
344 ImGui::DragFloat(
"Curve Tessellation Tolerance",
345 &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f,
347 if (style.CurveTessellationTol < 0.10f)
348 style.CurveTessellationTol = 0.10f;
352 ImGui::DragFloat(
"Circle Tessellation Max Error",
353 &style.CircleTessellationMaxError, 0.005f, 0.10f, 5.0f,
354 "%.2f", ImGuiSliderFlags_AlwaysClamp);
355 const bool show_samples = ImGui::IsItemActive();
356 if (show_samples) ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
357 if (show_samples && ImGui::BeginTooltip()) {
358 ImGui::TextUnformatted(
"(R = radius, N = number of segments)");
360 ImDrawList* draw_list = ImGui::GetWindowDrawList();
361 const float min_widget_width = ImGui::CalcTextSize(
"N: MMM\nR: MMM").x;
362 for (
int n = 0; n < 8; n++) {
363 const float RAD_MIN = 5.0f;
364 const float RAD_MAX = 70.0f;
366 RAD_MIN + (RAD_MAX - RAD_MIN) * (
float)n / (8.0f - 1.0f);
370 ImGui::Text(
"R: %.f\nN: %d", rad,
371 draw_list->_CalcCircleAutoSegmentCount(rad));
373 const float canvas_width = std::max(min_widget_width, rad * 2.0f);
374 const float offset_x = floorf(canvas_width * 0.5f);
375 const float offset_y = floorf(RAD_MAX);
377 const ImVec2 p1 = ImGui::GetCursorScreenPos();
378 draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad,
379 ImGui::GetColorU32(ImGuiCol_Text));
380 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
396 ImGui::DragFloat(
"Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f,
401 ImGui::DragFloat(
"Disabled Alpha", &style.DisabledAlpha, 0.005f, 0.0f,
405 ImGui::PopItemWidth();
413 ImGui::PopItemWidth();
424 ImGuiStyle* style = &ImGui::GetStyle();
425 ImVec4* colors = style->Colors;
427 style->WindowPadding = ImVec2(10.f, 10.f);
428 style->FramePadding = ImVec2(10.f, 2.f);
429 style->CellPadding = ImVec2(4.f, 5.f);
430 style->ItemSpacing = ImVec2(10.f, 5.f);
431 style->ItemInnerSpacing = ImVec2(5.f, 5.f);
432 style->TouchExtraPadding = ImVec2(0.f, 0.f);
433 style->IndentSpacing = 20.f;
434 style->ScrollbarSize = 14.f;
435 style->GrabMinSize = 15.f;
437 style->WindowBorderSize = 0.f;
438 style->ChildBorderSize = 1.f;
439 style->PopupBorderSize = 1.f;
440 style->FrameBorderSize = 0.f;
441 style->TabBorderSize = 0.f;
443 style->WindowRounding = 0.f;
444 style->ChildRounding = 0.f;
445 style->FrameRounding = 5.f;
446 style->PopupRounding = 0.f;
447 style->ScrollbarRounding = 5.f;
449 auto alttpDarkGreen = ImVec4(0.18f, 0.26f, 0.18f, 1.0f);
450 auto alttpMidGreen = ImVec4(0.28f, 0.36f, 0.28f, 1.0f);
451 auto allttpLightGreen = ImVec4(0.36f, 0.45f, 0.36f, 1.0f);
452 auto allttpLightestGreen = ImVec4(0.49f, 0.57f, 0.49f, 1.0f);
454 colors[ImGuiCol_MenuBarBg] = alttpDarkGreen;
455 colors[ImGuiCol_TitleBg] = alttpMidGreen;
457 colors[ImGuiCol_Header] = alttpDarkGreen;
458 colors[ImGuiCol_HeaderHovered] = allttpLightGreen;
459 colors[ImGuiCol_HeaderActive] = alttpMidGreen;
461 colors[ImGuiCol_TitleBgActive] = alttpDarkGreen;
462 colors[ImGuiCol_TitleBgCollapsed] = alttpMidGreen;
464 colors[ImGuiCol_Tab] = alttpDarkGreen;
465 colors[ImGuiCol_TabHovered] = alttpMidGreen;
466 colors[ImGuiCol_TabActive] = ImVec4(0.347f, 0.466f, 0.347f, 1.000f);
468 colors[ImGuiCol_Button] = alttpMidGreen;
469 colors[ImGuiCol_ButtonHovered] = allttpLightestGreen;
470 colors[ImGuiCol_ButtonActive] = allttpLightGreen;
472 colors[ImGuiCol_ScrollbarBg] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
473 colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.36f, 0.45f, 0.36f, 0.30f);
474 colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.36f, 0.45f, 0.36f, 0.40f);
475 colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
477 colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
478 colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
479 colors[ImGuiCol_WindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.85f);
480 colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
481 colors[ImGuiCol_PopupBg] = ImVec4(0.11f, 0.11f, 0.14f, 0.92f);
482 colors[ImGuiCol_Border] = allttpLightGreen;
483 colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
485 colors[ImGuiCol_FrameBg] = ImVec4(0.43f, 0.43f, 0.43f, 0.39f);
486 colors[ImGuiCol_FrameBgHovered] = ImVec4(0.28f, 0.36f, 0.28f, 0.40f);
487 colors[ImGuiCol_FrameBgActive] = ImVec4(0.28f, 0.36f, 0.28f, 0.69f);
489 colors[ImGuiCol_CheckMark] = ImVec4(0.90f, 0.90f, 0.90f, 0.50f);
490 colors[ImGuiCol_SliderGrab] = ImVec4(1.00f, 1.00f, 1.00f, 0.30f);
491 colors[ImGuiCol_SliderGrabActive] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
493 colors[ImGuiCol_Separator] = ImVec4(0.50f, 0.50f, 0.50f, 0.60f);
494 colors[ImGuiCol_SeparatorHovered] = ImVec4(0.60f, 0.60f, 0.70f, 1.00f);
495 colors[ImGuiCol_SeparatorActive] = ImVec4(0.70f, 0.70f, 0.90f, 1.00f);
496 colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 0.10f);
497 colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.78f, 0.82f, 1.00f, 0.60f);
498 colors[ImGuiCol_ResizeGripActive] = ImVec4(0.78f, 0.82f, 1.00f, 0.90f);
500 colors[ImGuiCol_TabUnfocused] =
501 ImLerp(colors[ImGuiCol_Tab], colors[ImGuiCol_TitleBg], 0.80f);
502 colors[ImGuiCol_TabUnfocusedActive] =
503 ImLerp(colors[ImGuiCol_TabActive], colors[ImGuiCol_TitleBg], 0.40f);
504 colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
505 colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
506 colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
507 colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
508 colors[ImGuiCol_TableHeaderBg] = alttpDarkGreen;
509 colors[ImGuiCol_TableBorderStrong] = alttpMidGreen;
510 colors[ImGuiCol_TableBorderLight] =
511 ImVec4(0.26f, 0.26f, 0.28f, 1.00f);
512 colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
513 colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.07f);
514 colors[ImGuiCol_TextSelectedBg] = ImVec4(0.00f, 0.00f, 1.00f, 0.35f);
515 colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
516 colors[ImGuiCol_NavHighlight] = colors[ImGuiCol_HeaderHovered];
517 colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
518 colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
519 colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
550 TextEditor::LanguageDefinition language_65816;
551 for (
auto& k : kKeywords) language_65816.mKeywords.emplace(k);
553 for (
auto& k : kIdentifiers) {
554 TextEditor::Identifier id;
555 id.mDeclaration =
"Built-in function";
556 language_65816.mIdentifiers.insert(std::make_pair(std::string(k),
id));
559 language_65816.mTokenRegexStrings.push_back(
560 std::make_pair<std::string, TextEditor::PaletteIndex>(
561 "[ \\t]*#[ \\t]*[a-zA-Z_]+", TextEditor::PaletteIndex::Preprocessor));
562 language_65816.mTokenRegexStrings.push_back(
563 std::make_pair<std::string, TextEditor::PaletteIndex>(
564 "L?\\\"(\\\\.|[^\\\"])*\\\"", TextEditor::PaletteIndex::String));
565 language_65816.mTokenRegexStrings.push_back(
566 std::make_pair<std::string, TextEditor::PaletteIndex>(
567 "\\'\\\\?[^\\']\\'", TextEditor::PaletteIndex::CharLiteral));
568 language_65816.mTokenRegexStrings.push_back(
569 std::make_pair<std::string, TextEditor::PaletteIndex>(
570 "[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)([eE][+-]?[0-9]+)?[fF]?",
571 TextEditor::PaletteIndex::Number));
572 language_65816.mTokenRegexStrings.push_back(
573 std::make_pair<std::string, TextEditor::PaletteIndex>(
574 "[+-]?[0-9]+[Uu]?[lL]?[lL]?", TextEditor::PaletteIndex::Number));
575 language_65816.mTokenRegexStrings.push_back(
576 std::make_pair<std::string, TextEditor::PaletteIndex>(
577 "0[0-7]+[Uu]?[lL]?[lL]?", TextEditor::PaletteIndex::Number));
578 language_65816.mTokenRegexStrings.push_back(
579 std::make_pair<std::string, TextEditor::PaletteIndex>(
580 "0[xX][0-9a-fA-F]+[uU]?[lL]?[lL]?",
581 TextEditor::PaletteIndex::Number));
582 language_65816.mTokenRegexStrings.push_back(
583 std::make_pair<std::string, TextEditor::PaletteIndex>(
584 "[a-zA-Z_][a-zA-Z0-9_]*", TextEditor::PaletteIndex::Identifier));
585 language_65816.mTokenRegexStrings.push_back(
586 std::make_pair<std::string, TextEditor::PaletteIndex>(
587 "[\\[\\]\\{\\}\\!\\%\\^\\&\\*\\(\\)\\-\\+\\=\\~\\|\\<\\>\\?\\/"
589 TextEditor::PaletteIndex::Punctuation));
591 language_65816.mCommentStart =
"/*";
592 language_65816.mCommentEnd =
"*/";
593 language_65816.mSingleLineComment =
";";
595 language_65816.mCaseSensitive =
false;
596 language_65816.mAutoIndentation =
true;
598 language_65816.mName =
"65816";
600 return language_65816;