private static void SpawnAddToFavFromHistoryMenuContent(UiWindow window, UiWindow favFolderMenuWindow, UiSpacer spacer,
                                                                Action <Color> setColor)
        {
            var scrollable = new UiScrollableContainer();

            scrollable.SetDimensions(400, 500);
            var favFolderMenuTitle = new UiTextBlock();

            favFolderMenuTitle.SetFont(Constants.Fonts.MyFirstCrush36);
            favFolderMenuTitle.SetString(ClientContext.LanguageDatabase.GetTranslationString("nimbusfox.foxcore.text.favorites"));
            favFolderMenuTitle.SetColor(Color.Orange);
            favFolderMenuWindow.AddChild(favFolderMenuTitle);
            favFolderMenuWindow.AddChild(spacer);
            favFolderMenuWindow.AddChild(scrollable);

            var newFolderButton = new UiButton();
            var newFolderText   = new UiTextBlock();

            newFolderText.SetString(ClientContext.LanguageDatabase.GetTranslationString("nimbusfox.foxcore.text.newFolder"));
            newFolderButton.OnClick += () => {
                favFolderMenuWindow.StopUpdateCalls();
                favFolderMenuWindow.Dispose();
                SpawnInputTextWindow(window, spacer, ClientContext.LanguageDatabase.GetTranslationString("nimbusfox.foxcore.text.name") + ":", ClientContext.LanguageDatabase.GetTranslationString("nimbusfox.foxcore.text.newFolder"), value => {
                    if (_favDir.Files.Any(x => x.ToLower() == value.ToLower()))
                    {
                        return(false);
                    }

                    using (var stream = _favDir
                                        .ObtainFileStream(value, FileMode.Create, FileAccess.ReadWrite)) {
                        stream.Seek(0L, SeekOrigin.Begin);
                    }

                    return(true);
                }, ClientContext.LanguageDatabase.GetTranslationString("nimbusfox.foxcore.text.folderExists"), ClientContext.LanguageDatabase.GetTranslationString("nimbusfox.foxcore.text.folderExists.message"), () => {
                    SpawnAddToFavFromHistoryMenu(window, spacer, setColor);
                });
            };
            newFolderButton.AddChild(newFolderText);
            scrollable.AddChild(newFolderButton);
            scrollable.AddChild(spacer);

            var files = _favDir.Files;

            if (files.Any())
            {
                foreach (var file in files)
                {
                    scrollable.AddChild(SpawnFolderItem(window, favFolderMenuWindow, spacer, setColor, file,
                                                        (folder) => {
                        var values = new List <string>();
                        if (_favDir.FileExists(folder))
                        {
                            values.AddRange(
                                File.ReadAllLines(
                                    Path.Combine(_favDir.GetPath(Path.DirectorySeparatorChar), folder)));
                        }

                        if (!values.Contains($"{_historyColor.R:X2}{_historyColor.G:X2}{_historyColor.B:X2}"))
                        {
                            values.Add($"{_historyColor.R:X2}{_historyColor.G:X2}{_historyColor.B:X2}");
                        }

                        File.WriteAllLines(Path.Combine(_favDir.GetPath(Path.DirectorySeparatorChar), folder), values);
                        return(true);
                    }, SpawnAddToFavFromHistoryMenu));
                    scrollable.AddChild(spacer);
                }
            }

            var closeButton = new UiButton();

            closeButton.SetBackground(Constants.Backgrounds.Button);

            var closeText = new UiTextBlock();

            closeText.SetString(ClientContext.LanguageDatabase.GetTranslationString("nimbusfox.foxcore.text.close"));

            closeButton.AddChild(closeText);

            scrollable.AddChild(closeButton);

            closeButton.OnClick += () => {
                favFolderMenuWindow.Dispose();
                window.ListenForEscape(true);
                window.Show();
                window.StartUpdateCalls();
            };
        }
        private static void SpawnFavoriteFolderMenuContent(UiWindow window, UiWindow favFolderMenuWindow, UiSpacer spacer,
                                                           Action <Color> setColor)
        {
            var scrollable = new UiScrollableContainer();

            scrollable.SetDimensions(400, 500);
            var favFolderMenuTitle = new UiTextBlock();

            favFolderMenuTitle.SetFont(Constants.Fonts.MyFirstCrush36);
            favFolderMenuTitle.SetString(ClientContext.LanguageDatabase.GetTranslationString("nimbusfox.foxcore.text.favorites"));
            favFolderMenuTitle.SetColor(Color.Orange);
            favFolderMenuWindow.AddChild(favFolderMenuTitle);
            favFolderMenuWindow.AddChild(spacer);
            favFolderMenuWindow.AddChild(scrollable);

            var newFolderButton = new UiButton();
            var newFolderText   = new UiTextBlock();

            newFolderText.SetString(ClientContext.LanguageDatabase.GetTranslationString("nimbusfox.foxcore.text.newFolder"));
            newFolderButton.OnClick += () => {
                favFolderMenuWindow.Dispose();
                SpawnInputTextWindow(window, spacer, ClientContext.LanguageDatabase.GetTranslationString("nimbusfox.foxcore.text.name") + ":", ClientContext.LanguageDatabase.GetTranslationString("nimbusfox.foxcore.text.newFolder"), value => {
                    if (_favDir.Files
                        .Any(x => x.ToLower() == value.ToLower()))
                    {
                        return(false);
                    }

                    using (var stream = _favDir
                                        .ObtainFileStream(value, FileMode.Create, FileAccess.ReadWrite)) {
                        stream.Seek(0L, SeekOrigin.Begin);
                    }

                    return(true);
                }, ClientContext.LanguageDatabase.GetTranslationString("nimbusfox.foxcore.text.folderExists"), ClientContext.LanguageDatabase.GetTranslationString("nimbusfox.foxcore.text.folderExists.message"), () => {
                    SpawnFavoriteFolderMenu(window, spacer, setColor);
                });
            };
            newFolderButton.AddChild(newFolderText);
            scrollable.AddChild(newFolderButton);
            scrollable.AddChild(spacer);

            var files = _favDir.Files;

            if (files.Any())
            {
                foreach (var file in files)
                {
                    scrollable.AddChild(SpawnFolderItem(window, favFolderMenuWindow, spacer, setColor, file,
                                                        (folder) => {
                        SpawnFolderColorWindow(favFolderMenuWindow, spacer, setColor, folder);
                        return(false);
                    }, SpawnFavoriteFolderMenu));
                    scrollable.AddChild(spacer);
                }
            }

            var closeButton = new UiButton();

            closeButton.SetBackground(Constants.Backgrounds.Button);

            var closeText = new UiTextBlock();

            closeText.SetString(ClientContext.LanguageDatabase.GetTranslationString("nimbusfox.foxcore.text.close"));

            closeButton.AddChild(closeText);

            favFolderMenuWindow.AddChild(closeButton);

            closeButton.OnClick += favFolderMenuWindow.Dispose;
        }
        private static void SpawnColorWindowContent(UiWindow window, UiWindow historyWindow, UiSpacer spacer,
                                                    Action <Color> setColor, Action <UiWindow, UiSpacer, Action <Color> > renew, Action <Color> remove, List <Color> colors, string title, string noColorText, bool showAddToFav = false)
        {
            var historyTitle = new UiTextBlock();

            historyTitle.SetString(title);
            historyTitle.SetColor(Color.Orange);
            historyTitle.SetFont(Constants.Fonts.MyFirstCrush36);
            historyWindow.AddChild(historyTitle);
            historyWindow.AddChild(spacer);

            if (!colors.Any())
            {
                var historyText = new UiTextBlock();
                historyText.SetString(noColorText);
                historyWindow.AddChild(historyText);
            }
            else
            {
                var column1        = new UiRow();
                var column1Squares = new UiColumn();
                var column1Text    = new UiColumn();
                var column1Buttons = new UiColumn();
                column1.AddChild(column1Squares);
                column1.AddChild(UiSpacer.GetSpacer());
                column1.AddChild(column1Text);
                column1.AddChild(UiSpacer.GetSpacer());
                column1.AddChild(column1Buttons);

                var column2        = new UiRow();
                var column2Squares = new UiColumn();
                var column2Text    = new UiColumn();
                var column2Buttons = new UiColumn();
                column2.AddChild(column2Squares);
                column2.AddChild(UiSpacer.GetSpacer());
                column2.AddChild(column2Text);
                column2.AddChild(UiSpacer.GetSpacer());
                column2.AddChild(column2Buttons);

                var column = 1;
                var count  = 0;
                foreach (var color in colors)
                {
                    SpawnHistoryColorItem(window, historyWindow, color, spacer, setColor, renew, remove, showAddToFav, out var colorSquare, out var colorText, out var buttons);
                    if (count >= 2)
                    {
                        if (column == 1)
                        {
                            column1Squares.AddChild(UiSpacer.GetSpacer(0, 20));
                            column1Text.AddChild(UiSpacer.GetSpacer(0, 12));
                            column1Buttons.AddChild(UiSpacer.GetSpacer(0, 15));
                        }
                        else
                        {
                            column2Squares.AddChild(UiSpacer.GetSpacer(0, 20));
                            column2Text.AddChild(UiSpacer.GetSpacer(0, 12));
                            column2Buttons.AddChild(UiSpacer.GetSpacer(0, 15));
                        }
                    }

                    if (column == 1)
                    {
                        column1Squares.AddChild(colorSquare);
                        column1Text.AddChild(colorText);
                        column1Buttons.AddChild(buttons);
                        column = 2;
                    }
                    else
                    {
                        column2Squares.AddChild(colorSquare);
                        column2Text.AddChild(colorText);
                        column2Buttons.AddChild(buttons);
                        column = 1;
                    }

                    count++;
                }
                var columnRow = new UiRow();
                columnRow.AddChild(column1);
                if (colors.Count >= 2)
                {
                    columnRow.AddChild(UiSpacer.GetSpacer(10, 0));
                    columnRow.AddChild(column2);
                }

                var scrollable = new UiScrollableContainer();
                scrollable.AddChild(columnRow);
                scrollable.SetDimensions(600, 400);
                historyWindow.AddChild(scrollable);
            }

            historyWindow.AddChild(spacer);

            var closeButton = new UiButton();

            closeButton.SetBackground(Constants.Backgrounds.Button);

            var closeText = new UiTextBlock();

            closeText.SetString(ClientContext.LanguageDatabase.GetTranslationString("nimbusfox.foxcore.text.close"));

            closeButton.AddChild(closeText);

            historyWindow.AddChild(closeButton);

            closeButton.OnClick += historyWindow.Dispose;
        }