Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force Light Mode permanently on #297

Merged
merged 6 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion LightBulb/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,27 @@
<framework:ViewManager />
</Application.DataTemplates>

<Application.Resources>
<!-- Override theme Primary color -->
<SolidColorBrush x:Key="MaterialPrimaryLightBrush" Color="#343838"></SolidColorBrush>
<SolidColorBrush x:Key="MaterialPrimaryLightForegroundBrush" Color="#343838"></SolidColorBrush>
<SolidColorBrush x:Key="MaterialPrimaryMidBrush" Color="#343838"></SolidColorBrush>
<SolidColorBrush x:Key="MaterialPrimaryMidForegroundBrush" Color="White"></SolidColorBrush>
<SolidColorBrush x:Key="MaterialPrimaryDarkBrush" Color="#343838"></SolidColorBrush>
<SolidColorBrush x:Key="MaterialPrimaryForegroundBrush" Color="#343838"></SolidColorBrush>

<!-- Override theme Secondary color -->
<SolidColorBrush x:Key="MaterialSecondaryLightBrush" Color="#F9A825"></SolidColorBrush>
<SolidColorBrush x:Key="MaterialSecondaryLightForegroundBrush" Color="#F9A825"></SolidColorBrush>
<SolidColorBrush x:Key="MaterialSecondaryMidBrush" Color="#F9A825"></SolidColorBrush>
<SolidColorBrush x:Key="MaterialSecondaryMidForegroundBrush" Color="#F9A825"></SolidColorBrush>
<SolidColorBrush x:Key="MaterialSecondaryDarkBrush" Color="#F9A825"></SolidColorBrush>
<SolidColorBrush x:Key="MaterialSecondaryDarkForegroundBrush" Color="#F9A825"></SolidColorBrush>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may be wrong, but shouldn't all these colors not be the same?

</Application.Resources>

<Application.Styles>
<materialStyles:MaterialTheme />
<!-- Dummy values for foreground colors to initialize properly. All associated brushes are overridden in Application.Resources. -->
<materialStyles:MaterialTheme BaseTheme="Light" PrimaryColor="Purple" SecondaryColor="Green"/>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the dummy values actually necessary here? If so, what do they achieve?

<materialIcons:MaterialIconStyles />
<dialogHostAvalonia:DialogHostStyles />

Expand Down
9 changes: 0 additions & 9 deletions LightBulb/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
using Avalonia.Threading;
using LightBulb.Framework;
using LightBulb.Services;
Expand All @@ -15,7 +14,6 @@
using LightBulb.ViewModels.Components.Settings;
using LightBulb.ViewModels.Dialogs;
using LightBulb.Views;
using Material.Styles.Themes;
using Microsoft.Extensions.DependencyInjection;

namespace LightBulb;
Expand Down Expand Up @@ -94,13 +92,6 @@ public override void OnFrameworkInitializationCompleted()
desktopLifetime.MainWindow = new MainView { DataContext = _mainViewModel };

base.OnFrameworkInitializationCompleted();

// Set custom theme colors
this.LocateMaterialTheme<MaterialThemeBase>().CurrentTheme = Theme.Create(
Theme.Light,
Color.Parse("#343838"),
Color.Parse("#F9A825")
);
}

private void ShowMainWindow()
Expand Down