SIGN IN SIGN UP

[verified] fix(sheet): make every palette swatch countable

Two remaining causes of "k=n shows n-1 swatches" after 6547546:

1. The replacement allocator kept all colours visible but destroyed the
   weighting it exists to show: trimming only the largest span turned an
   80/10/10 palette into 34/33/33. Replace it with constrained
   proportional apportionment — pin only the colours whose ideal share
   falls under the countability floor, re-apportion the rest by weight,
   and settle integer rounding by largest remainder so spans sum exactly
   to the band width.

2. Median cut can emit adjacent entries that quantise to the same RGB
   (observed on gallery/MS201412-AddisAbaba0315.jpg for 31 of 62 legal k
   values). Those occupy separate spans but merge visually, so the viewer
   counts one swatch short. Draw a one-pixel boundary that contrasts with
   both neighbours instead of dropping the duplicate manifest fact.

The all-k pixel test now counts contiguous regions wider than a hairline
rather than asserting a fixed run pattern, so it measures the user-facing
contract instead of the mechanism. Verified it fails on the pre-fix
allocator with "k=9: expected 9 countable swatches, saw 8".
M
Mahesh Shantaram committed
d8ecaf32ce655313e27d523dc16e2ae1fdf2cbb6
Parent: 6547546