March 13, 2026

Fifty Shades of Beige, No More

Okmain: How to pick an OK main colour of an image

Dev drops a better image color pick — designers cheer, skeptics roast the 1‑pixel hack

TLDR: A new library, Okmain, picks a nicer “main color” from images using smarter grouping and a human‑vision color model. Designers praise it, skeptics mock the old one‑pixel trick, power users want a CLI, and others plug rival tools—because better auto‑colors can make apps look instantly more polished.

Move over, “squish-your-photo-to-one-pixel” — a new open‑source tool called Okmain promises prettier, more “true to the vibe” colors pulled from any image. The author ditches the muddy average and uses smart clustering plus a color model that mimics human vision, then ships it in Rust with a Python wrapper. The crowd? Loud. Designers flooded in with big nods: one pro said the method nails why the “most visible” shade isn’t always the “right” one, praising the perceptual approach. But the thread’s spice rack tipped over when skeptics dragged the old baseline: shrinking an image to one pixel got roasted as “hacky,” prompting a mini‑pile‑on of “why was that ever a thing?” jokes. Meanwhile, power users demanded a command‑line tool yesterday, because nothing says “tasteful color” like a terminal window. Then came the tool wars: fans shouted out OKPalette as their go‑to, and another commenter flexed an R package, colorhull, born from summarizing IKEA catalogs — yes, flat‑pack color science is now canon. The vibe: half applause for a cleaner, happier swatch, half friendly chaos over baselines and alternatives. One‑pixel beige? Dead. Tasteful auto‑palettes? Very much alive.

Key Points

  • Okmain is a library that selects a representative, visually pleasing main color from images.
  • It improves on 1x1-pixel averaging by using color clustering, Oklab color calculations, and chroma/position-based sorting.
  • Color clustering is implemented via K-means with up to four clusters, reducing when clusters are too similar.
  • Averaging colors in sRGB is discouraged due to gamma correction; Oklab provides perceptually meaningful averaging.
  • Okmain is implemented in Rust with a Python wrapper, documented, and released on crates.io and PyPI.

Hottest takes

“I’d be interested in trying this out as a command-line tool. It would be useful on its own and the fastest way to evaluate results.” — latexr
“the most representative colour may not be the one that appears the most” — iamcalledrob
“I’m surprised the baseline to compare against is shrinking the image to one pixel, that seems extremely hacky” — bee_rider
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.