A code for grabbing the dominant color from an image. Uses ColorThief for C# and .NET to make it happen.
Operating System | Architecture | Supported | Version |
---|---|---|---|
Windows 10 | x86, x64, ARM, ARM64 | Yes | 16299 or higher |
Windows 8.1 | x86, x64 | No | |
Windows 8 | x86, x64 | No | |
Windows 7 | x86, x64 | No |
var colorThief = new ColorThief();
colorThief.GetColor(sourceImage);
In this example, we build an 8 color palette.
var colorThief = new ColorThief();
colorThief.GetPalette(sourceImage, 8);
For Xamarin.Forms
await CrossColorThief.Current.GetPalette(sourceImage);
- Start Microsoft Visual Studio and select File > Open > Project/Solution.
- Go to the folder where you unzipped the sample. Double-click the Visual Studio Solution (.sln) file.
- Press Ctrl+Shift+B, or select Build > Build Solution.
After opening the Visual Studio solution, set the architecture to x64 or x86. The next steps depend on whether you just want to deploy the sample or you want to both deploy and run it.
-
Deploy
- Select Build > Deploy Solution.
-
Deploy and run
- To debug the sample and then run it, press F5 or select Debug > Start Debugging.
- To run the sample without debugging, press Ctrl+F5 or select Debug > Start Without Debugging.
ColorThief.UWP is a MIT-style licensed, as found in the LICENSE file.