public ThemeOption(
            VisualizerDialogTheme theme,
            VisualizerDialog dialog)
        {
            _theme  = theme;
            _dialog = dialog;

            Size = new SizeF(
                ThemeOptionWidth * dialog.WidthFactor,
                MenuItemHeight * dialog.HeightFactor).ToSize();

            Checked = theme.Name == dialog.Theme.Name;

            dialog.RegisterThemeable(this);

            base.Font      = MenuItemFont;
            base.TextAlign = ContentAlignment.MiddleLeft;
            base.Text      = theme.Name;

            CheckedChanged += (sender, args) =>
            {
                var option = (ThemeOption)sender;

                if (option._dialog.Viewer.Uninitialised)
                {
                    return;
                }

                if (Checked && (option == this))
                {
                    option._dialog.HandleThemeChanged(option._theme);
                }
            };
        }
        public void SetTheme(VisualizerDialogTheme theme)
        {
            var args = new object[]
            {
                theme.Background,
                theme.Default,
                theme.Keyword,
                theme.Variable,
                theme.TypeName,
                theme.InterfaceName,
                theme.CommandStatement,
                theme.Text,
                theme.Numeric,
                theme.MethodName,
                theme.Comment
            };

            Document.InvokeScript("setTheme", args);
        }