<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <ControlTheme TargetType="Button" x:Key="{x:Type Button}">
        <Setter Property="ClickMode" Value="Press" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="ToolTip.BetweenShowDelay" Value="-1" />
        <Setter Property="ToolTip.ShowDelay" Value="900" />

        <Setter Property="Button.Template">
            <ControlTemplate TargetType="Button">
                <ContentPresenter
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Content="{TemplateBinding Content}"
                    ContentTemplate="{TemplateBinding ContentTemplate}"
                    CornerRadius="{TemplateBinding CornerRadius}"
                    HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                    Name="PART_ContentPresenter"
                    Padding="{TemplateBinding Padding}"
                    RecognizesAccessKey="True"
                    TextElement.Foreground="{TemplateBinding Foreground}"
                    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
            </ControlTemplate>
        </Setter>

        <!--  Start of animations  -->

        <Style Selector="^.hover:pointerover /template/ ContentPresenter#PART_ContentPresenter">
            <Style.Animations>
                <Animation Duration="{StaticResource ButtonHoverAnimationDuration}" IterationCount="1">
                    <KeyFrame>
                        <Setter Property="Foreground">
                            <SolidColorBrush Color="{DynamicResource MainTextColor}" />
                        </Setter>
                        <Setter Property="Background">
                            <SolidColorBrush Color="{DynamicResource SecondaryBackgroundColor}" />
                        </Setter>
                        <Setter Property="BorderBrush">
                            <SolidColorBrush Color="{DynamicResource MainBorderColor}" />
                        </Setter>
                    </KeyFrame>
                    <KeyFrame Cue="1">
                        <Setter Property="Foreground">
                            <SolidColorBrush Color="{StaticResource SecondaryTextColor}" />
                        </Setter>
                        <Setter Property="Background">
                            <SolidColorBrush Color="{DynamicResource AccentColor}" />
                        </Setter>
                        <Setter Property="BorderBrush">
                            <SolidColorBrush Color="{DynamicResource AccentColor}" />
                        </Setter>
                    </KeyFrame>
                </Animation>
            </Style.Animations>
            <Setter Property="Foreground" Value="{StaticResource SecondaryTextColor}" />
            <Setter Property="Background" Value="{DynamicResource AccentColor}" />
            <Setter Property="BorderBrush" Value="{DynamicResource AccentColor}" />
        </Style>

        <Style Selector="^.accentHover:pointerover /template/ ContentPresenter#PART_ContentPresenter">
            <Style.Animations>
                <Animation Duration="{StaticResource ButtonHoverAnimationDuration}" IterationCount="1">
                    <KeyFrame>
                        <Setter Property="Foreground">
                            <SolidColorBrush Color="{StaticResource SecondaryTextColor}" />
                        </Setter>
                        <Setter Property="Background">
                            <SolidColorBrush Color="{DynamicResource AccentColor}" />
                        </Setter>
                        <Setter Property="BorderBrush">
                            <SolidColorBrush Color="{DynamicResource MainBorderColor}" />
                        </Setter>
                    </KeyFrame>
                    <KeyFrame Cue="1">
                        <Setter Property="Foreground">
                            <SolidColorBrush Color="#fff" />
                        </Setter>
                        <Setter Property="Background">
                            <SolidColorBrush Color="{DynamicResource SecondaryAccentColor}" />
                        </Setter>
                        <Setter Property="BorderBrush">
                            <SolidColorBrush Color="{DynamicResource SecondaryAccentColor}" />
                        </Setter>
                    </KeyFrame>
                </Animation>
            </Style.Animations>
            <Setter Property="Foreground" Value="#fff" />
            <Setter Property="Background" Value="{DynamicResource SecondaryAccentColor}" />
            <Setter Property="BorderBrush" Value="{DynamicResource SecondaryAccentColor}" />
        </Style>

        <Style Selector="^.errorHover:pointerover /template/ ContentPresenter#PART_ContentPresenter">
            <Style.Animations>
                <Animation Duration="{StaticResource ButtonHoverAnimationDuration}" IterationCount="1">
                    <KeyFrame>
                        <Setter Property="Background">
                            <SolidColorBrush Color="{StaticResource ErrorColor}" />
                        </Setter>
                    </KeyFrame>
                    <KeyFrame Cue="1">
                        <Setter Property="Foreground">
                            <SolidColorBrush Color="{StaticResource SecondaryTextColor}" />
                        </Setter>
                        <Setter Property="Background">
                            <SolidColorBrush Color="{StaticResource ErrorColor}" />
                        </Setter>
                    </KeyFrame>
                </Animation>
            </Style.Animations>
            <Setter Property="Foreground" Value="{StaticResource SecondaryTextColor}" />
            <Setter Property="Background" Value="{StaticResource ErrorColor}" />
        </Style>
        <Style Selector="^.altHover:pointerover /template/ ContentPresenter#PART_ContentPresenter">
            <Style.Animations>
                <Animation Duration="{StaticResource ButtonHoverAnimationDuration}" IterationCount="1">
                    <KeyFrame>
                        <Setter Property="Background">
                            <SolidColorBrush Color="{DynamicResource SecondaryBackgroundColor}" />
                        </Setter>
                        <Setter Property="BorderBrush">
                            <SolidColorBrush Color="{DynamicResource OuterBorderColor}" />
                        </Setter>
                    </KeyFrame>
                    <KeyFrame Cue="1">
                        <Setter Property="Background">
                            <SolidColorBrush Color="{DynamicResource AltBackgroundHoverColor}" />
                        </Setter>
                        <Setter Property="BorderBrush">
                            <SolidColorBrush Color="{DynamicResource SecondaryBorderColor}" />
                        </Setter>
                    </KeyFrame>
                </Animation>
            </Style.Animations>
            <Setter Property="Background" Value="{DynamicResource AltBackgroundHoverColor}" />
            <Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderColor}" />
        </Style>

        <Style Selector="^.noBorderHover:pointerover /template/ ContentPresenter#PART_ContentPresenter">
            <Style.Animations>
                <Animation Duration="{StaticResource ButtonHoverAnimationDuration}" IterationCount="1">
                    <KeyFrame>
                        <Setter Property="Background">
                            <SolidColorBrush Color="{DynamicResource MainButtonBackgroundColor}" />
                        </Setter>
                    </KeyFrame>
                    <KeyFrame Cue="1">
                        <Setter Property="Background">
                            <SolidColorBrush Color="{DynamicResource BackgroundHoverColor}" />
                        </Setter>
                    </KeyFrame>
                </Animation>
            </Style.Animations>
            <Setter Property="Background" Value="{DynamicResource BackgroundHoverColor}" />
        </Style>

        <Style Selector="^.noBorderHoverAlt:pointerover /template/ ContentPresenter#PART_ContentPresenter">
            <Style.Animations>
                <Animation Duration="{StaticResource ButtonHoverAnimationDuration}" IterationCount="1">
                    <KeyFrame>
                        <Setter Property="Background">
                            <SolidColorBrush Color="{DynamicResource MainButtonBackgroundColor}" />
                        </Setter>
                        <Setter Property="Foreground">
                            <SolidColorBrush Color="{DynamicResource MainTextColor}" />
                        </Setter>
                    </KeyFrame>
                    <KeyFrame Cue="1">
                        <Setter Property="Background">
                            <SolidColorBrush Color="{DynamicResource SecondaryAccentColor}" />
                        </Setter>
                        <Setter Property="Foreground">
                            <SolidColorBrush Color="{StaticResource SecondaryTextColor}" />
                        </Setter>
                    </KeyFrame>
                </Animation>
            </Style.Animations>
            <Setter Property="Background" Value="{DynamicResource SecondaryAccentColor}" />
            <Setter Property="Foreground" Value="{StaticResource SecondaryTextColor}" />
        </Style>

        <Style Selector="^.foregroundHover:pointerover /template/ ContentPresenter#PART_ContentPresenter">
            <Style.Animations>
                <Animation Duration="{StaticResource ButtonHoverAnimationDuration}" IterationCount="1">
                    <KeyFrame>
                        <Setter Property="Foreground">
                            <SolidColorBrush Color="{DynamicResource MainTextColor}" />
                        </Setter>
                    </KeyFrame>
                    <KeyFrame Cue="1">
                        <Setter Property="Foreground">
                            <SolidColorBrush Color="{DynamicResource AccentColor}" />
                        </Setter>
                    </KeyFrame>
                </Animation>
            </Style.Animations>
            <Setter Property="Foreground" Value="{DynamicResource AccentColor}" />
        </Style>

        <Style Selector="^.foregroundHoverAlt:pointerover /template/ ContentPresenter#PART_ContentPresenter">
            <Style.Animations>
                <Animation Duration="{StaticResource ButtonHoverAnimationDuration}" IterationCount="1">
                    <KeyFrame>
                        <Setter Property="Foreground">
                            <SolidColorBrush Color="{DynamicResource MainTextColor}" />
                        </Setter>
                        <Setter Property="Background">
                            <SolidColorBrush Color="Transparent" />
                        </Setter>
                    </KeyFrame>
                    <KeyFrame Cue="1">
                        <Setter Property="Foreground">
                            <SolidColorBrush Color="{StaticResource SecondaryTextColor}" />
                        </Setter>
                        <Setter Property="Background">
                            <SolidColorBrush Color="{DynamicResource AltBackgroundHoverColor}" />
                        </Setter>
                    </KeyFrame>
                </Animation>
            </Style.Animations>
            <Setter Property="Foreground" Value="{StaticResource SecondaryTextColor}" />
            <Setter Property="Background" Value="{DynamicResource AltBackgroundHoverColor}" />
        </Style>

        <!--  End of animations  -->

        <Style Selector="^.noAnimHover:pointerover /template/ ContentPresenter#PART_ContentPresenter">
            <Setter Property="Background" Value="{DynamicResource AccentColor}" />
            <Setter Property="Foreground" Value="{DynamicResource MainTextColor}" />
        </Style>

        <Style Selector="^.active /template/ ContentPresenter#PART_ContentPresenter">
            <Setter Property="Background" Value="{DynamicResource SecondaryAccentColor}" />
            <Setter Property="BorderBrush" Value="{DynamicResource SecondaryAccentColor}" />
        </Style>

        <Style Selector="^:not(.active).hover:pressed  /template/ ContentPresenter#PART_ContentPresenter">
            <Setter Property="Background" Value="{DynamicResource SecondaryAccentColor}" />
        </Style>
        <Style Selector="^:not(.active).altHover:pressed  /template/ ContentPresenter#PART_ContentPresenter">
            <Setter Property="Background" Value="{DynamicResource AltBackgroundHoverColor}" />
            <Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderColor}" />
        </Style>

        <Style Selector="^.focus:focus-within /template/ ContentPresenter#PART_ContentPresenter">
            <Setter Property="BorderBrush" Value="{DynamicResource AccentColor}" />
            <Setter Property="BorderThickness" Value="1" />
        </Style>

        <Style Selector="^:disabled">
            <Setter Property="Opacity" Value="{StaticResource ThemeDisabledOpacity}" />
        </Style>
    </ControlTheme>

    <ControlTheme
        BasedOn="{StaticResource {x:Type Button}}"
        TargetType="RepeatButton"
        x:Key="{x:Type RepeatButton}" />


</ResourceDictionary>