App Development

Palette vs. The Dress: What Color Does Android See?

palette vs the dress-510x288

It’s black and blue. That’s what Taylor Swift says. If that’s not enough for you, that’s also what the actual product listing says.

But what does Android see?

Using the Palette API, we can programmatically determine the colors of the dress. Spoiler alert: blue is definitely one of them. So if you’re on team black and blue, you’re probably feeling pretty good right now. And if you’re on team blue and gold, that’s not a team. Here’s the Very Scientific Method that we used ( source code and a debug APK):

We built an app that checks the six main colors generated by Palette using two versions of the dress: the full-size original image, and an image cropped to just the dress itself. We chose to crop the image as an option because of the horrible exposure. The app also allows you to input a total number of colors generated by Palette. As one of our engineers, Chris Thoma, has written before, Palette will choose from this total number of colors to find the closest match to its six main colors. Here’s what we found: palette vs the dress

Using Palette with 32 generated colors ( suggested by Chris Banes here) and the full image of the dress, the vibrant color is a shade of gold and muted a shade of blue. Before all you white/gold’ers start celebrating, though, it’s worth noting that the bright yellow overexposure on the right side of the image is definitely a contributing factor. When using the cropped image, which is focused on the dress itself, gold is nowhere to be found. Five of the six colors returned are a shade of blue.

But wait! What about white? There must be some sort of manipulation we can do to justify this clearly incorrect opinion. It turns out that with just six generated colors on the full-size image only, you get something like a shade of white for the light muted color. So if you choose to sample a minimal number of colors on an incredibly overexposed image, yes, you’ll find that there is some white. Note that blue is still one of the primary colors.

Summary: Using every possible combination of generated colors and images, blue is always found. Only with the full-size overexposed image do you find gold as a color. And only with one specific example do you ever find white. Sorry, Tommy.

Conclusion: It’s black and blue, folks. Just like the Backstreet Boys would’ve wanted it.

Quickstart-Guide-to-Kotlin-Multiplatform

A Quick Start Guide to Kotlin Multiplatform

Kotlin Multiplatform, though still experimental, is a great up-and-coming solution...

Read the article