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

Launching LightBulb for the first time in dark mode causes brief light mode flash #300

Open
4 of 5 tasks
LilithSilver opened this issue May 18, 2024 · 2 comments
Open
4 of 5 tasks
Labels

Comments

@LilithSilver
Copy link
Contributor

Version

v2.5

Platform

Windows 10

Steps to reproduce

  1. Set system theme to Dark
  2. Open LightBulb
  3. Note that the light mode briefly flashes on, before transitioning quickly back to dark mode.

Details

A fairly minor cosmetic issue, but I believe it was introduced in 03218e8. The reason is that MaterialTheme is not meant to be overridden from code with the CurrentTheme property -- MaterialThemeBase is for that purpose.

Using the following in App.axaml fixes the issue for me:

...
<Style>
    <Style.Resources>
        <ResourceDictionary>
            <!-- Fix bug with initialization of MaterialPaperBrush using MaterialThemeBase -->
            <SolidColorBrush x:Key="MaterialPaperBrush" Color="#FF0000"></SolidColorBrush>
        </ResourceDictionary>
    </Style.Resources>
</Style>
<materialStyles:MaterialThemeBase />
...

I assume it was changed to avoid the awkward bug fix, which is a bug with Avalonia.DialogHost (pretty sure). We could always tackle the bug on their end?

Checklist

  • I have looked through existing issues to make sure that this bug has not been reported before
  • I have provided a descriptive title for this issue
  • I have made sure that this bug is reproducible on the latest version of the application
  • I have provided all the information needed to reproduce this bug as efficiently as possible
  • I have sponsored this project
@Tyrrrz
Copy link
Owner

Tyrrrz commented May 18, 2024

A fairly minor cosmetic issue, but I believe it was introduced in 03218e8. The reason is that MaterialTheme is not meant to be overridden from code with the CurrentTheme property -- MaterialThemeBase is for that purpose.

I understand that, but I found that MaterialThemeBase works extremely poorly and there were too many issues I've experienced in the projects where I tried to use it. In general, the Material tooling seems to be very buggy when it comes to Avalonia.

After some consideration, I decided that using MaterialTheme was the least of all available evils.

The flash still seems to happen even when using MaterialThemeBase, it just goes from black (colors unset) to dark instead of light to dark. It's more noticeable if your configured theme is set to light instead of dark, in that case.

@LilithSilver
Copy link
Contributor Author

The flash still seems to happen even when using MaterialThemeBase, it just goes from black (colors unset) to dark instead of light to dark. It's more noticeable if your configured theme is set to light instead of dark, in that case.

Interesting, I see that now -- This happens with my proposed fix, but not in my original PR code. Not sure where the bug is, then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants