Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi committed Aug 12, 2024
1 parent cbe1bf1 commit 2f4cd2e
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class ThemeColors
{
public static readonly string BackgroundColorPrimaryDark = "#000000";
public static readonly string BackgroundColorPrimaryLight = "#FFFFFF";
public static readonly string PrimaryDarkBgColor = "#000000";
public static readonly string PrimaryLightBgColor = "#FFFFFF";
// In case you need to change the background color, make sure to also update app.scss's --bit-clr-bg-pri accordingly.
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

:root[bit-theme="dark"] {
--bit-clr-bg-pri: #000000;
// In case you need to change the background color, make sure to also update ThemeColors.cs's BackgroundColorPrimaryDark accordingly.
// In case you need to change the background color, make sure to also update ThemeColors.cs's PrimaryDarkBgColor accordingly.
}

* {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
xmlns:b="clr-namespace:Microsoft.AspNetCore.Components.WebView.Maui;assembly=Microsoft.AspNetCore.Components.WebView.Maui"
xmlns:core="clr-namespace:Boilerplate.Client.Core;assembly=Boilerplate.Client.Core"
xmlns:themeColors="clr-namespace:Boilerplate.Client.Core.Styles;assembly=Boilerplate.Client.Core"
BackgroundColor="{AppThemeBinding Light={x:Static themeColors:ThemeColors.BackgroundColorPrimaryLight},
Dark={x:Static themeColors:ThemeColors.BackgroundColorPrimaryDark}}">
BackgroundColor="{AppThemeBinding Light={x:Static themeColors:ThemeColors.PrimaryLightBgColor},
Dark={x:Static themeColors:ThemeColors.PrimaryBgColorDark}}">
<b:BlazorWebView
x:Name="AppWebView"
BackgroundColor="{AppThemeBinding Light={x:Static themeColors:ThemeColors.BackgroundColorPrimaryLight},
Dark={x:Static themeColors:ThemeColors.BackgroundColorPrimaryDark}}"
BackgroundColor="{AppThemeBinding Light={x:Static themeColors:ThemeColors.PrimaryLightBgColor},
Dark={x:Static themeColors:ThemeColors.PrimaryBgColorDark}}"
HostPage="wwwroot/index.html">
<b:BlazorWebView.RootComponents>
<b:RootComponent ComponentType="{x:Type core:Routes}" Selector="#app-container" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private static void SetupBlazorWebView()
{
var webView = handler.PlatformView;
var webViewBackgroundColor = AppInfo.Current.RequestedTheme == AppTheme.Dark ?
ThemeColors.BackgroundColorPrimaryDark : ThemeColors.BackgroundColorPrimaryLight;
ThemeColors.PrimaryDarkBgColor : ThemeColors.PrimaryLightBgColor;
#if Windows
webView.DefaultBackgroundColor = Color.FromArgb(webViewBackgroundColor).ToWindowsColor();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public async Task ApplyTheme(bool isDark)
window!.DecorView!.SystemUiFlags &= ~Android.Views.SystemUiFlags.LightStatusBar;
}

window.SetStatusBarColor(Android.Graphics.Color.ParseColor(isDark ? ThemeColors.BackgroundColorPrimaryDark : ThemeColors.BackgroundColorPrimaryLight));
window.SetStatusBarColor(Android.Graphics.Color.ParseColor(isDark ? ThemeColors.PrimaryDarkBgColor : ThemeColors.PrimaryLightBgColor));
#elif IOS
var statusBarStyle = isDark ? UIKit.UIStatusBarStyle.LightContent : UIKit.UIStatusBarStyle.DarkContent;
await Device.InvokeOnMainThreadAsync(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<SolidColorBrush x:Key="BackgroundColorPrimary">#0D2960</SolidColorBrush>
<SolidColorBrush x:Key="PrimaryBgColor">#0D2960</SolidColorBrush>
</ResourceDictionary>
</Application.Resources>
</Application>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public App()
var splash = new SplashScreen(typeof(App).Assembly, @"Resources\SplashScreen.png");
splash.Show(autoClose: true, topMost: true);

Resources["BackgroundColorPrimary"] = new BrushConverter().ConvertFrom(IsDarkTheme() ? ThemeColors.BackgroundColorPrimaryDark : ThemeColors.BackgroundColorPrimaryLight);
Resources["PrimaryBgColor"] = new BrushConverter().ConvertFrom(IsDarkTheme() ? ThemeColors.PrimaryDarkBgColor : ThemeColors.PrimaryLightBgColor);
}

private static bool IsDarkTheme()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="Boilerplate"
Background="{DynamicResource BackgroundColorPrimary}"
Background="{DynamicResource PrimaryBgColor}"
WindowState="Maximized"
mc:Ignorable="d">
<Grid>
Expand Down

0 comments on commit 2f4cd2e

Please sign in to comment.