-
Notifications
You must be signed in to change notification settings - Fork 339
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
Implement AppThemeColor, AppThemeObject, and AppThemeResource #1264
Conversation
src/CommunityToolkit.Maui/Extensions/AppThemeExtension.shared.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Gerald! I've only done a partial review, but at first glance it looks like we can simplify AppThemeColor.cs
a bit. What do you think?
samples/CommunityToolkit.Maui.Sample/Pages/Essentials/AppThemePage.xaml
Outdated
Show resolved
Hide resolved
@brminnick yep thanks! That was my outstanding comment on refactoring it to use the same code. Applied that now. There is one base I've left |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good in general, I've feel comments around the AppThemeObject
class
src/CommunityToolkit.Maui/Extensions/AppThemeExtension.shared.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui/Extensions/AppThemeExtension.shared.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui/Extensions/AppThemeExtension.shared.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
OK I think I have all the feedback processed. Then the only question remains if we want to rename If you start typing |
src/CommunityToolkit.Maui/Essentials/AppTheme/AppThemeObjectOfT.shared.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui/Extensions/AppThemeExtension.shared.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui/Extensions/AppThemeExtension.shared.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui/Extensions/AppThemeExtension.shared.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui/Essentials/AppTheme/AppThemeObjectOfT.shared.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui/Essentials/AppTheme/AppThemeResource.shared.cs
Outdated
Show resolved
Hide resolved
A color is a resource though, even in this code, it literally just inherits from the resource. But this is more about it being clear to the consumer and not the technicalities I guess 😄 |
OK went with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Gang! I think we should the classes to Theme...
now that we renamed ThemeResouceExtension
:
public class AppThemeResource
->public class ThemeResource
public class AppThemeColor
->public class ThemeColor
Renaming will give us better consistency in XAML:
- Updated:
<mct:ThemeResource ... />
- Current
<mct:AppThemeResource ... />
- Current
- Updated:
<mct:ThemeColor ... />
- Current:
<mct:AppThemeColor ... />
- Current:
- Current:
{mct:ThemeResource ...}
src/CommunityToolkit.Maui/Essentials/AppTheme/AppThemeObjectOfT.shared.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui/Essentials/AppTheme/AppThemeResource.shared.cs
Outdated
Show resolved
Hide resolved
@brminnick So yeah, funny story, now we're back to square 1. The extension is called: ThemeResource and now we have an object ThemeResource... 😅 |
😊
From: Brandon Minnick ***@***.***>
Sent: Sunday, July 16, 2023 11:04 AM
To: CommunityToolkit/Maui ***@***.***>
Cc: Gary Lewis ***@***.***>; Mention ***@***.***>
Subject: Re: [CommunityToolkit/Maui] Implement AppThemeColor and AppThemeResource (PR #1264)
Oh no!! 🙈🙃😭
Naming is so hard...
[image]<https://user-images.githubusercontent.com/13558917/253819702-98b18e0c-aa41-4dc0-9af5-e230c47bc46d.png>
—
Reply to this email directly, view it on GitHub<#1264 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADFAH7BEE4KQ4RR4QEXM5WDXQQUHNANCNFSM6AAAAAAZRJDD4U>.
You are receiving this because you were mentioned.Message ID: ***@***.******@***.***>>
|
This reverts commit 3b3d472.
…ppThemeResource` -> `AppThemeObject`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Gerald!! I think we finally got the naming:
public sealed class AppThemeColor : AppThemeObject<Color>;
public sealed class AppThemeObject : AppThemeObject<object>;
public abstract class AppThemeObject<T>;
public sealed class AppThemeResourceExtension : IMarkupExtension<BindingBase>;
I approve, and I'll defer to you to merge it to give you time to review the updates.
👇 Here's how these names look in the Sample app
Still todo:
This adds the AppThemeColor and AppThemeResource objects that make it easier to work with colors and other resources in light/dark theme scenarios. This enables you to define colors (and resources) in resource dictionaries, making your XAML less verbose and more reusable.
Original PR on .NET MAUI by Dan Siegel: dotnet/maui#8839