Repository navigation
💭 Dream window: gradient-style — SDR fallback follows oklab/oklch interpolation (longer hue too) + snippet really falls back - #139
Merged
Conversation
…tually falls back The classic gradient copied stops 1:1 as hex, so browsers without `in <space>` support (and the HDR-off preview) drew sRGB interpolation: oklab lost its bright midpoints and `oklch longer hue` red->red was solid red. The classic now bakes the real interpolation (space, hue mode, premultiplied alpha, transition hints, CSS stop fixup) into adaptive sRGB stops read back from the modern string. The copied snippet only ever applied --hdr-gradient, which leaves no background at all where `in <space>` is unsupported; it now starts from --sdr-gradient and upgrades under @supports. The HDR toggle is no longer hidden for longer hue. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g stop lists Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ Deploy Preview for hd-gradients ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Owner
Author
…ltiply hue, never one stop - colorjs 0.5 keeps parsed values as Number objects, so Number.isFinite() read a typed alpha as opaque and `color(srgb ...)` coords as 0 (black) on the first stop and hard stops - stops are now pushed from their segment's own interpolation, so a `none` component borrows from the neighbour it blends with (a jump at the stop when the two sides differ, like browsers) - own CSS Color 4 interpolation instead of Color.range(): colorjs premultiplies the hue too, which put hsl/oklch fades between two hues on the wrong hue - a solid gradient keeps two stops; `linear-gradient(#f00)` is invalid in the browsers that actually use this fallback Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Problem
The classic (SDR) gradient copied the stops 1:1 as hex. A browser without
in <colorspace>support (and the HDR-off preview, and any tool that only does sRGB) interpolates those in sRGB, so it drew a different gradient:in oklablost its bright midpoints (blue to yellow went through gray)in oklch longer huefrom red to red was solid red (the Huey preset), which is why the HDR toggle was hidden forlongerThe copied snippet also only ever applied
var(--hdr-gradient). Custom properties accept anything, so wherein <space>is unsupported that declaration is invalid at computed-value time and the element got no background at all;--sdr-gradientwas defined but never used.Solution
src/utils/fallbackStops.ts: reads the stops back out of the modern string (exactly what the browser renders), resolves them per CSS Images 4 §3.5.3 (default ends, fixup against earlier stops and hints, even spacing), then samples the real interpolation (chosen space + hue mode, premultiplied alpha, transition-hint curve) and adaptively adds sRGB stops wherever plain sRGB lerp would drift more than ~half a JND (deltaE OK 0.02). Hard stops and repeating periods stay intact, a span is written as one double-position stop, and the list is capped at about 100 stops for long stop lists. Out-of-gamut colors clip the way Chrome draws them on an sRGB screen. Length positions (10px) fall back to the old 1:1 copy.srgbgradients are untouched (byte-identical output).--sdr-gradientand upgrades to--hdr-gradientunder@supports (background: linear-gradient(in oklch, red, red)), grain included.longerhue too, and its hint copy explains what the classic preview is.Impact
--user-modernvs--user-classic), and no preset got worse. Huey 157 to 5, Chlorophyll 76 to 1.3, LearnUI 53 to 2.2.npm test(119, 8 new) andnpm run lintpass.svelte-checkalready reported 650 errors on main and isn't part of CI.🤖 Generated with Claude Code