Skip to content

Find the dominant / most common colors in game banners on the Steam store.

License

Notifications You must be signed in to change notification settings

woctezuma/steam-palette-extractor

Repository files navigation

Steam Palette Extractor

This repository contains Python code to find the dominant / most common colors in Steam banners.

Illustration cover

Usage

Run extract_steam_palette.ipynb Open In Colab

Approach

A palette is an ordered list of N colors. In our case, N is arbitrarily set to 8.

We consider:

  • a source palette, typically the palette of the gift wrapping,
  • a database of target palettes, typically the palettes of every Steam game.

Match colors

In order to match palettes, we first need to be able to match colors.

Colors can be represented in the following spaces:

  • RGB,
  • HSV:
    • raw,
    • linearized,
  • CIE LAB,
  • CIE LUV.

The distance between colors is the L2 norm in this space.

It is possible to take into account:

  • the index of the color in the target palette,
  • the difference between the indices of the colors in the source and target palettes.

The objective is to incentivize the matching to colors which are respetively:

  • predominant in the target palettes, i.e. with low indices,
  • at lease more predominant in the target than in the source palette, i.e. with lower indices.

In the latter case, thresholds can be used in order not to distinguish between target colors which have an index lower than the color in the source palette.

Match palettes

The distance between colors can be:

  • the Mean Pairwise Distance,
  • the Hausdorff distance,
  • a modified Hausdorff "distance",
  • a custom Hausdorff distance, similar to Minimum Color Difference.

It is possible to take into account:

  • the index of the color in the source palette.

The objective is to re-weigh the color distances in order to give more importance to the errors for colors which are predominant in the source palette. The weights can be normalized so that they sum to 1, as the idea is only to re-balance the terms in the error.

As with the matching of colors, it is possible to take into account:

  • the index of the color in the target palette,
  • the difference between the indices of the colors in the source and target palettes.

Here, in contrast to what was done with the matching of colors, the idea is to penalize rather than incentivize.

As with the matching of colors, thresholds can be used for more subtle touches.

Results

A benchmark of the parameters used for the palette distance is shown on the Wiki.

References