This little demo shows how to calculate the average color value of a video frame during playback.
The color name is displayed as well as the color value.
This can be useful when creating 508 accessible content, for example for color blinded people.
I used the colorThief library for calculating the average color.
Note that you can also calculate the frame average palette if you need to display more colors,
however this results in slower performances.
After getting the color value, I use the "Name that color" library by Chirag Mehta to display the color name.
You can view the source code for this demo by right-clicking the demo and choosing "View Frame Source".
Adding a macOS widget to a Flutter app using SwiftUI
7 months ago