-
Notifications
You must be signed in to change notification settings - Fork 75
ColorAnalyzer Component Creation #734
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
base: main
Are you sure you want to change the base?
Conversation
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 is amazing! Can't wait to start using it 😁!!
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.
Pull Request Overview
This PR introduces the AccentAnalyzer helper component, which enables extraction of color palettes from UIElements (particularly images) for use in XAML bindings. The AccentAnalyzer uses k-means clustering algorithms to identify dominant, primary, secondary, and tertiary colors from an image source, providing properties that can be bound to in XAML.
- Implements k-means clustering algorithm for color analysis and extraction
- Provides bindable color properties (PrimaryAccentColor, SecondaryAccentColor, etc.) and colorfulness metric
- Includes complete sample application demonstrating color extraction from images with visual color palette display
Reviewed Changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
AccentAnalyzer.cs | Core analyzer class with dependency properties and async color extraction logic |
AccentAnalyzer.Clustering.cs | K-means clustering implementation and colorfulness calculation algorithms |
AccentAnalyzerSample.xaml | Sample page demonstrating color binding to visual elements |
AccentAnalyzerSampleOptionsPane.xaml.cs | Options pane allowing dynamic image URL input |
Various project/config files | Standard project structure and build configuration |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Link to original discussion: #254 We should use the issue template to create a tracking experiment for this and use that in the doc link. |
Experiment Issue created |
9dee104
to
7f02a15
Compare
7f02a15
to
58c6e78
Compare
9536a90
to
8486c9b
Compare
@Avid29 To make space for other color-related helpers in the future, I'm thinking we should rename the component to ColorAnalyzer while keeping the name/code for AccentAnalyzer as-is. Thoughts? @michael-hawker or @niels9001? |
@Arlodotexe Makes complete sense to me |
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.
All reviewable concerns were addressed in 9cd306f. Approved! 🚀
This is very strange, we're seeing issues with
There may have been an issue with the incremental builds when the component was renamed that prevented it from running properly. I'll have to branch off I'm not seeing this same error on the wasdk multitarget. In the meantime, I'll rerun this to see if it helps there. Update: I'm not seeing any build errors locally, even in release mode. Let's wait for the CI to retry to see if it self-corrects... Update 2: The Wasdk error provides a bit more insight, still not enough to tell exactly what happened:
It almost looks like Windows SDKs were removed from the runner. |
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.
Need at least the images changed I think for licensing concerns.
Future discussion: I could see the calculations done in a .NET library without UI dependency, then maybe a behavior pattern could be better. As basically you could have a 'result' and just regular C# properties without so many DP that way, or you could encapsulate them in another POCO record/class and the result holder is the DP that gets updated and notify bindings and such (I think that'd work...) Anyway, for now this is a good thing to get more feedback on, I know folks have been looking for this type of stuff for a while.
Thanks for the contribution!
Adds the first iteration of the AccentAnalyzer, a helper which allows for binding to colors extracted from images or other UIElements.
Example:
