Add conic-gradient() and repeating-conic-gradient()#207
Open
jhaygood86 wants to merge 1 commit into
Open
Conversation
jhaygood86
marked this pull request as ready for review
July 22, 2026 22:50
conic-gradient()/repeating-conic-gradient() (CSS Images 4 3.4) had no support. Add a real ConicGradientConverter, not a pass-through: it parses the optional "[ from <angle> ]? [ at <position> ]?" prelude and an <angular-color-stop> list whose stops are positioned by an <angle-percentage> rather than a <length-percentage>. The stop-position parser in the shared GradientConverter base is made an overridable member (defaulting to the existing length-or-percent converter, so linear and radial are unchanged) and the conic subclass overrides it with angle-or-percent. Wire the new converter into GradientConverter so every <image> property accepts it. A first comma group beginning with a color, angle or percentage is a color stop, not a prelude, so ConvertFirstArgument rejects it and the caller treats it as the first stop.
jhaygood86
force-pushed
the
feature/conic-gradient
branch
from
July 23, 2026 22:27
c88adf2 to
db26728
Compare
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.
Feature
Adds
conic-gradient()andrepeating-conic-gradient()(CSS Images 4 §3.4):Implementation
A real
ConicGradientConverter(not a pass-through). Two things distinguish a conic gradient from linear/radial:[ from <angle> ]? [ at <position> ]?instead of an angle or shape/size.<angular-color-stop>positions its stops with an<angle-percentage>, not a<length-percentage>.To support (2) cleanly, the stop-position parser in the shared
GradientConverterbase becomes an overridable member (StopPositionConverter), defaulting to the existing length-or-percent converter — so linear and radial are byte-for-byte unchanged — and the conic subclass overrides it with angle-or-percent.A first comma group that begins with a color, angle, or percentage is a stop, not a prelude, so
ConvertFirstArgumentrejects it and the caller treats it as the first stop (e.g.conic-gradient(red 0deg, …)).The converter is wired into
GradientConverter, so every<image>property (background-image,list-style-image, …) accepts it.Tests
12 cases in
Gradient.cs:from <angle>,at <position>, both, angle stops, percentage stops,1turn, andrepeating-conic-gradientfrom red(needs an angle),at,(needs a position),red 0px(conic stops are angular, not length)The full suite (1263 existing tests) stays green, and all seven target frameworks build with no new warnings.