Skip to content

Commit

Permalink
Use theme dictionaries
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz committed May 15, 2024
1 parent ccfaf2c commit 3bc6110
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
15 changes: 0 additions & 15 deletions YoutubeDownloader/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,6 @@ private void InitializeTheme()
actualTheme == PlatformThemeVariant.Light
? Theme.Create(Theme.Light, Color.Parse("#343838"), Color.Parse("#F9A825"))
: Theme.Create(Theme.Dark, Color.Parse("#E8E8E8"), Color.Parse("#F9A825"));

Resources["SuccessBrush"] =
actualTheme == PlatformThemeVariant.Light
? new SolidColorBrush(Colors.DarkGreen)
: new SolidColorBrush(Colors.LightGreen);

Resources["CanceledBrush"] =
actualTheme == PlatformThemeVariant.Light
? new SolidColorBrush(Colors.DarkOrange)
: new SolidColorBrush(Colors.Orange);

Resources["FailedBrush"] =
actualTheme == PlatformThemeVariant.Light
? new SolidColorBrush(Colors.DarkRed)
: new SolidColorBrush(Colors.OrangeRed);
}

public override void OnFrameworkInitializationCompleted()
Expand Down
16 changes: 16 additions & 0 deletions YoutubeDownloader/Views/Components/DashboardView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,22 @@
Classes.started="{Binding Status, Converter={x:Static converters:EqualityConverter.Equality}, ConverterParameter={x:Static components:DownloadStatus.Started}}"
PointerReleased="StatusTextBlock_OnPointerReleased"
TextTrimming="CharacterEllipsis">
<TextBlock.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<SolidColorBrush x:Key="SuccessBrush" Color="DarkGreen" />
<SolidColorBrush x:Key="CanceledBrush" Color="DarkOrange" />
<SolidColorBrush x:Key="FailedBrush" Color="DarkRed" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="SuccessBrush" Color="LightGreen" />
<SolidColorBrush x:Key="CanceledBrush" Color="Orange" />
<SolidColorBrush x:Key="FailedBrush" Color="OrangeRed" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</TextBlock.Resources>
<TextBlock.Styles>
<Style Selector="TextBlock">
<Style Selector="^.enqueued">
Expand Down

0 comments on commit 3bc6110

Please sign in to comment.