You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(webapp): make the contrast percentage mean the same thing in every theme
The stored value was a position on one shared scale, and Black's slider was
offset on top of it. So Black at 100% stored 70, and switching to Light showed
70% - the number followed the implementation rather than the user.
It's now a percentage of whichever theme's range is active. 35% is 35% wherever
you switch to; each theme decides where its own 0% and 100% sit. Black's range is
-30 to 100, so its 0% fades the grid lines below the base palette - where this
theme wants to start - and its 100% is full strength like everywhere else. The
others run 0 to 100 as they always did.
The mapping moved into CSS, one line per theme, because the alternative was
teaching three JS call sites which theme had resolved - and on `system` that
isn't settled until hydration, so the server would have picked the wrong range
and corrected it on the client. Now JS writes a single
`--theme-contrast-percent` and each theme block turns it into the strengthen and
fade halves the ramps read.
Two things fall out of this. The stored value is a plain 0-100 again, so the
schema floor and the normalizer go back to 0 - no negative ever leaves the page.
And Black finally defaults to its faint end for a new user, rather than only
showing them where the default tick was: 0% is the bottom of Black's range, not
the base palette.
The slider is a straight pass-through again, and the page no longer needs to
resolve the active theme at all.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments