public NavigationViewTabItem(T value)
                : base(value)
            {
                Highlight = new ThemableBox {
                    Colour = ThemeSlot.AccentPrimary
                };

                Add(background = new ThemableBox
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = ThemeSlot.Transparent,
                });

                Add(LabelContainer = new Container
                {
                    Margin = new MarginPadding {
                        Horizontal = 12
                    },
                    AutoSizeAxes     = Axes.X,
                    RelativeSizeAxes = Axes.Y,
                });

                if (Icon != null)
                {
                    LabelContainer.Add(icon = new ThemableSpriteIcon
                    {
                        Icon   = Icon ?? default,
                        Size   = new Vector2(16),
                        Colour = ThemeSlot.Black,
                        Anchor = Anchor.CentreLeft,
                        Origin = Anchor.CentreLeft,
                    });
        public void TestThemeSwitching()
        {
            AddStep("create themable", () => Schedule(() =>
            {
                Add(themable = new ThemableBox
                {
                    Size   = new Vector2(100),
                    Colour = ThemeSlot.White,
                });
            }));

            AddAssert("is colour white", () => themable.Target.Colour == Colour4.White);
            AddStep("change theme", () => Selector.Current.Value = Theme.Dark);
            AddAssert("is colour black", () => themable.Target.Colour == Colour4.Black);
        }
            public ExitButton()
            {
                BackgroundResting  = ThemeSlot.Transparent;
                BackgroundHovered  = ThemeSlot.Error;
                BackgroundPressed  = ThemeSlot.ErrorBackground;
                BackgroundDisabled = ThemeSlot.Transparent;

                Children = new Drawable[]
                {
                    background = new ThemableBox
                    {
                        RelativeSizeAxes = Axes.Both,
                    },
                    new ThemableSpriteIcon
                    {
                        Icon   = FluentSystemIcons.Dismiss28,
                        Size   = new Vector2(9),
                        Anchor = Anchor.Centre,
                        Origin = Anchor.Centre,
                        Colour = ThemeSlot.Black,
                    },
                };
            }
        public void TestDrawableDetachment(bool expireTarget)
        {
            AddStep("create drawables", () => Schedule(() =>
            {
                Add(themable = new ThemableBox(false)
                {
                    Colour = ThemeSlot.White,
                });

                Add(target = themable.Create().With(d =>
                {
                    d.RelativeSizeAxes = Axes.None;
                    d.Size             = new Vector2(100);
                }));
            }));

            AddAssert("is target white", () => target.Colour == Colour4.White);
            AddStep("change theme", () => Selector.Current.Value = Theme.Dark);
            AddAssert("is target black", () => target.Colour == Colour4.Black);

            string toExpire = expireTarget ? "target" : "themable";
            string toCheck  = expireTarget ? "themable" : "target";

            AddStep($"expire {toExpire}", () =>
            {
                if (expireTarget)
                {
                    target.Expire();
                }
                else
                {
                    themable.Expire();
                }
            });

            AddAssert($"is {toCheck} dead", () => expireTarget ? !themable.IsAlive : !target.IsAlive);
        }
 protected override Drawable CreateBackground()
 => background = new ThemableBox
 {
     RelativeSizeAxes = Axes.Both
 };