Pull every color out of a CSS gradient
Gradients pack several colors into a single CSS value, which makes them awkward to reuse. This extractor parses a gradient string and hands back a clean list of just the color stops — with their positions — so you can rebuild a palette, generate design tokens, or feed the colors into another tool.
How it works
A CSS gradient looks like linear-gradient(<direction>, <stop>, <stop>, ...). The first step is to identify the gradient function (linear, radial, or conic, optionally prefixed with repeating-) and grab everything inside the outer parentheses. Those contents are then split at top-level commas only: a small parenthesis-depth counter ensures that commas inside rgba(254, 180, 123, 0.4) are not mistaken for argument separators.
Each resulting argument is classified. Arguments that match a direction or shape pattern — to right, 135deg, 0.5turn, circle, at center, and similar — are dropped because they carry no color. The remaining arguments are color stops. Within a stop, any trailing length or percentage (such as 0%, 50%, or 20px) is separated out and reported as the stop’s position, leaving the bare color value behind.
Notes and example
Given linear-gradient(135deg, #ff7e5f 0%, #feb47b 50%, rgba(254,180,123,0.4) 100%), the tool reports the type as linear-gradient and lists three stops: #ff7e5f @ 0%, #feb47b @ 50%, and rgba(254,180,123,0.4) @ 100%. The 135deg direction is filtered out automatically.
This is useful when a designer hands you a gradient and you need the individual swatches, or when you want to convert a gradient palette into a different format with one of the sibling color tools.