AathifMahir.Maui.MauiTheme 0.0.1-preview

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
This is a prerelease version of AathifMahir.Maui.MauiTheme.
There is a newer version of this package available.
See the version list below for details.
dotnet add package AathifMahir.Maui.MauiTheme --version 0.0.1-preview
NuGet\Install-Package AathifMahir.Maui.MauiTheme -Version 0.0.1-preview
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AathifMahir.Maui.MauiTheme" Version="0.0.1-preview" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AathifMahir.Maui.MauiTheme --version 0.0.1-preview
#r "nuget: AathifMahir.Maui.MauiTheme, 0.0.1-preview"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AathifMahir.Maui.MauiTheme as a Cake Addin
#addin nuget:?package=AathifMahir.Maui.MauiTheme&version=0.0.1-preview&prerelease

// Install AathifMahir.Maui.MauiTheme as a Cake Tool
#tool nuget:?package=AathifMahir.Maui.MauiTheme&version=0.0.1-preview&prerelease

Maui Theme

Latest Stable Latest Preview
AathifMahir.Maui.MauiShakeDetector AathifMahir.Maui.MauiShakeDetector

MauiTheme is Theming Libray that Makes the Theming on Dotnet Maui a Breeze with Persistent Theme State Between Sessions and Seamless Resource Swapping, Theme Switcher and etc..

Get Started

You need to Call InitializeTheme() in the App.xaml.cs Like Below Example

public partial class App : Application
{
    public App()
    {
        InitializeComponent();

        MainPage = new AppShell();

        Theme.Default.InitializeTheme<App>(x =>
        {
            // Default Theme
            x.DefaultTheme = AppTheme.Dark;
            // Default Styles Resources
            x.DefaultStyleResources = ["Resources/Styles/Styles.xaml"];
            // All Resources Excluding Styles
            x.Resources = new()
                {
                    {"Blue", "Resources/Styles/Blue.xaml"},
                    {"Purple", "Resources/Styles/Colors.xaml"},
                    {"Yellow", "Resources/Styles/Yellow.xaml" },
                    {"Green", "Resources/Styles/Green.xaml" }
                };
            
        });

    }
}

App.xaml Setup

The App.xaml should include the Default Color and Style Resource Like Below Example

<Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
            
                <ResourceDictionary Source="Resources/Styles/Yellow.xaml" />
                <ResourceDictionary Source="Resources/Styles/Styles.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
</Application.Resources>

Initialize Properties

Parameters Type Description
DefaultTheme enum The Default Theme, if the Theme is Previously Not Assigned by User
DefaultStyleResources Dictionary<string, string> The Default Style Resources that Needs to Applied with Every Resource Change Eg: Styles.xaml
Resources Dictionary<string, string> All Resources in the Project Excluding Style Resources

Theme

When it comes to Switching Theme, You can change the CurrentTheme Property to Switch the Theme Like Below Example


// Dark
Theme.Default.CurrentTheme = AppTheme.Dark;

// Light
Theme.Default.CurrentTheme = AppTheme.Light;

// System
Theme.Default.CurrentTheme = AppTheme.UnSpecified;

Resources

When it comes to Switching Resource, You can use CurrentResource Property to Swap the Resources Like Below Example, Make sure to Note that Resources is Applied Using The Key that you have passed into InitializeTheme Resources Property


// Blue.xaml
Theme.Default.CurrentResource = "Blue";

// Purple.xaml
Theme.Default.CurrentResource = "Purple";

// Yellow.xaml
Theme.Default.CurrentResource = "Yellow";

License

Maui Shake Detector is Licensed Under MIT License.

Contribute and Credit

Credits for @taublast for Helping with Resource Creation.

If you wish to contribute to this project, please don't hesitate to create an issue or request. Your input and feedback are highly appreciated. Additionally, if you're interested in supporting the project by providing resources or becoming a sponsor, your contributions would be welcomed and instrumental in its continued development and success. Thank you for your interest in contributing to this endeavor.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-android33.0 is compatible.  net7.0-ios was computed.  net7.0-ios16.1 is compatible.  net7.0-maccatalyst was computed.  net7.0-maccatalyst16.1 is compatible.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-android34.0 is compatible.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-ios17.0 is compatible.  net8.0-maccatalyst was computed.  net8.0-maccatalyst17.0 is compatible.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net8.0-windows10.0.19041 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.5.0 147 1/21/2024
0.1.1-preview 100 1/16/2024
0.1.0-preview 62 1/16/2024
0.0.1-preview 81 1/8/2024

v0.0.1-preview
• Initial Preview Version