@@ -105,30 +105,35 @@ private void InitializeTheme()
105105 _ => PlatformSettings ? . GetColorValues ( ) . ThemeVariant
106106 } ;
107107
108- if ( actualTheme == PlatformThemeVariant . Light )
108+ this . LocateMaterialTheme < MaterialThemeBase > ( ) . CurrentTheme = actualTheme switch
109109 {
110- this . LocateMaterialTheme < MaterialThemeBase > ( ) . CurrentTheme = Theme . Create (
111- Theme . Light ,
112- Color . Parse ( "#343838" ) ,
113- Color . Parse ( "#F9A825" )
114- ) ;
115-
116- Resources [ "SuccessBrush" ] = new SolidColorBrush ( Colors . DarkGreen ) ;
117- Resources [ "CanceledBrush" ] = new SolidColorBrush ( Colors . DarkOrange ) ;
118- Resources [ "FailedBrush" ] = new SolidColorBrush ( Colors . DarkRed ) ;
119- }
120- else
110+ PlatformThemeVariant . Light
111+ => Theme . Create ( Theme . Light , Color . Parse ( "#343838" ) , Color . Parse ( "#F9A825" ) ) ,
112+ PlatformThemeVariant . Dark
113+ => Theme . Create ( Theme . Dark , Color . Parse ( "#E8E8E8" ) , Color . Parse ( "#F9A825" ) ) ,
114+ _ => throw new InvalidOperationException ( $ "Unknown theme '{ actualTheme } '.")
115+ } ;
116+
117+ Resources [ "SuccessBrush" ] = actualTheme switch
118+ {
119+ PlatformThemeVariant . Light => new SolidColorBrush ( Colors . DarkGreen ) ,
120+ PlatformThemeVariant . Dark => new SolidColorBrush ( Colors . LightGreen ) ,
121+ _ => throw new InvalidOperationException ( $ "Unknown theme '{ actualTheme } '.")
122+ } ;
123+
124+ Resources [ "CanceledBrush" ] = actualTheme switch
121125 {
122- this . LocateMaterialTheme < MaterialThemeBase > ( ) . CurrentTheme = Theme . Create (
123- Theme . Dark ,
124- Color . Parse ( "#E8E8E8" ) ,
125- Color . Parse ( "#F9A825" )
126- ) ;
127-
128- Resources [ "SuccessBrush" ] = new SolidColorBrush ( Colors . LightGreen ) ;
129- Resources [ "CanceledBrush" ] = new SolidColorBrush ( Colors . Orange ) ;
130- Resources [ "FailedBrush" ] = new SolidColorBrush ( Colors . OrangeRed ) ;
131- }
126+ PlatformThemeVariant . Light => new SolidColorBrush ( Colors . DarkOrange ) ,
127+ PlatformThemeVariant . Dark => new SolidColorBrush ( Colors . Orange ) ,
128+ _ => throw new InvalidOperationException ( $ "Unknown theme '{ actualTheme } '.")
129+ } ;
130+
131+ Resources [ "FailedBrush" ] = actualTheme switch
132+ {
133+ PlatformThemeVariant . Light => new SolidColorBrush ( Colors . DarkRed ) ,
134+ PlatformThemeVariant . Dark => new SolidColorBrush ( Colors . OrangeRed ) ,
135+ _ => throw new InvalidOperationException ( $ "Unknown theme '{ actualTheme } '.")
136+ } ;
132137 }
133138
134139 public override void OnFrameworkInitializationCompleted ( )
0 commit comments