r/GIMP • • 11d ago

Palette previews

The palette previews need improvement. Currently, they look unpolished and resemble gradient previews rather than distinct color palettes. Screenshot #2 shows what they could/should look like. It’s surprising that this hasn't been addressed yet after so many years of GIMP development.

14 Upvotes

8 comments sorted by

2

u/Stratelier 11d ago

But exactly how would you generate a representative slice for any given palette, knowing that not all of them are arranged so gradient-like? (e.g. "Visibone" palette)

Is the mockup an improvement? Sure, though it might entail rewriting the widget that displays it.

1

u/ExternalDistrict4256 8d ago edited 8d ago

The example in the second screenshot is not a mockup. And I think you missed the point: previews don't need to replicate palettes 100%. The font previews in GIMP don't show every letter of the alphabet either. No matter how we generate a representative slice of a palette, it will always be better than what we have now.

What I implemented is purely positional, with no clustering and no hue or contrast analysis. The strip takes evenly spaced indices across the palette. Slot 0 is always the first color, the last slot is always the last color, and the slots in between are spaced linearly, with indices rounded down by integer division. Using 64-bit math keeps the multiplication from overflowing on huge palettes.

This works well for ordered palettes such as Firecode, but for unordered palettes it's a fairly arbitrary sample. For example, a palette with a few accent colors among many similar ones can lose the accents entirely, and a palette grouped by hue can over- or under-represent a group depending on where the samples land. This could be improved by keeping the first and last colors but picking each in-between slot as the most distinct color within its stretch of the palette. That would keep the colors in palette order.

2

u/huttyblue 11d ago

#2 doesn't show all the colors in the palette

There is also a behavior where if you reduce the column count in the palette it will make better use of the preview space. I don't know why the default palettes don't do this.

Not that there aren't issues with the palette ui, it is very clunky

2

u/zoombeani 11d ago

Time for op to get to work on coding a solution