Skip to content

Different colors for Light and Dark theme from system #377

Closed Answered by LilithSilver
LilithSilver asked this question in Q&A
Discussion options

You must be logged in to vote

Answered my own question. This is how to replicate the behavior of MaterialTheme using MaterialThemeBase.

    public override void OnFrameworkInitializationCompleted()
    {
        base.OnFrameworkInitializationCompleted();

        if (PlatformSettings is IPlatformSettings settings)
        {
            settings.ColorValuesChanged += PlatformSettings_ColorValuesChanged;
            SetupTheme(settings.GetColorValues());
        }
    }

    private void PlatformSettings_ColorValuesChanged(object? sender, PlatformColorValues colors)
    {
        SetupTheme(colors);
    }

    private void SetupTheme(PlatformColorValues colors)
    {
        if (colors.ThemeVariant == PlatformThemeVariant.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@SKProCH
Comment options

Answer selected by SKProCH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants