Skip to content

Fix Stripes preset: strict equality for auto-position suppression, suppress auto-computed hints#129

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/review-and-fix-issue
Draft

Fix Stripes preset: strict equality for auto-position suppression, suppress auto-computed hints#129
Copilot wants to merge 3 commits intomainfrom
copilot/review-and-fix-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 25, 2026

The Stripes (and Neon Stripe) gradient presets generated incorrect CSS output — missing span end positions (#000 0% instead of #000 0% 20%) and including noisy auto-computed midpoint hints — causing stripes to render as solid black.

Root causes

  • Loose equality (==) for auto-position suppressionString(p1) == String(s.auto) coerced the explicit string '0' (from preset position1: '0') to equal the auto-computed number 0, stripping the start of spans. #0ff 0% 12% became #0ff 12%.
  • Auto-assigned 0% leaked onto the first stop — a no-position leading stop (e.g., {color: '#fff'}) got position1=0, position2=0 from updateStops; only p1 was suppressed, leaving an unwanted trailing 0%.
  • isPctZero stripped the 0% span start — no guard for the presence of p2, so a stop like {position1: '0', position2: '12'} had its 0% incorrectly removed.
  • Gradient.svelte included auto-computed hints — the local stopsToStrings was missing the same midpoint-hint suppression that gradientString.ts already had.

Changes

  • src/utils/gradientString.ts: p1 === s.auto (strict) replaces String(p1) == String(s.auto); isPctZero only strips when no p2 exists; suppresses auto-assigned p2 on the first stop when p1 was also auto-suppressed.
  • src/components/Gradient.svelte (stopsToStrings): Same strict-equality fix and first-stop p2 suppression; adds s.percentage == s.auto guard to skip auto-computed midpoint hints.

Before / after for the Stripes preset:

/* before */
linear-gradient(to top right in oklab, #fff, #000 0%, #fff 0%, #000 0%, #fff 0%, #000 0%)

/* after */
linear-gradient(to top right in oklab, #fff, #000 0% 20%, #fff 0% 40%, #000 0% 60%, #fff 0% 80%, #000 0% 100%)
  • src/lib/roundtrip.test.ts: Two new test cases using stopWithAuto/hintWithAuto helpers that simulate real updateStops output — covering the clean first-stop case and the preserved explicit span case.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@netlify
Copy link
Copy Markdown

netlify bot commented Feb 25, 2026

Deploy Preview for hd-gradients ready!

Name Link
🔨 Latest commit 6d3c728
🔍 Latest deploy log https://app.netlify.com/projects/hd-gradients/deploys/699e96f39738050008144235
😎 Deploy Preview https://deploy-preview-129--hd-gradients.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI and others added 2 commits February 25, 2026 06:26
Co-authored-by: argyleink <1134620+argyleink@users.noreply.github.com>
…ion, clean first stop, skip auto hints

Co-authored-by: argyleink <1134620+argyleink@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix identified issue with measurable success criteria Fix Stripes preset: strict equality for auto-position suppression, suppress auto-computed hints Feb 25, 2026
Copilot AI requested a review from argyleink February 25, 2026 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants