Sadly not AI detecting hats and then finding colours based on lighting of faces and rest of scene.
Reply on news.ycombinator.com