CKTIS / CSS
radial-gradient(): color spreading from a center
Generate a circular or elliptical image with controlled color stops, position and extent.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
background-image: radial-gradient(circle 20px at 50px 50px, red 0% 50%, blue 50% 100%);radial-gradient() creates an image whose colors spread out from a center along circles or ellipses. Use it where CSS accepts an image, such as background-image, not as a color value. The shape, size and position describe the gradient geometry; the color stops describe how colors change along it. Without an explicit shape or size, the usual default is an ellipse extending to the farthest corner.
In circle 20px at 50px 50px, 20px is the ending radius, not the diameter, and the center is 50px from the left and top. The 100% stop is on that ending circle. Two color stops meeting at the same position make a hard boundary. The ending shape does not clip the image: after the last stop, its last color continues. Use repeating-radial-gradient() if repetition is actually wanted.
The example places red over 0%–50% and blue over 50%–100%, so the hard boundary is at radius 10px. A generated SVG containing the styled element is painted into a canvas without a network request. The center pixel is red; pixels 15px away horizontally and vertically are blue. A pixel 40px away is also blue, proving that the 20px ending radius is not a clipping edge.
Examples
const value='radial-gradient(circle 20px at 50px 50px, red 0% 50%, blue 50% 100%)';
const svg='<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><foreignObject width="100" height="100"><div xmlns="http://www.w3.org/1999/xhtml" style="width:100px;height:100px;background:'+value+'"></div></foreignObject></svg>';
const image=new Image();image.src='data:image/svg+xml;charset=utf-8,'+encodeURIComponent(svg);await image.decode();
const canvas=document.createElement('canvas');canvas.width=canvas.height=100;const ctx=canvas.getContext('2d');ctx.drawImage(image,0,0);
const pixel=(x,y)=>[...ctx.getImageData(x,y,1,1).data].slice(0,3).join(',');
console.log('center='+pixel(50,50)+'; horizontal='+pixel(65,50)+'; vertical='+pixel(50,65)+'; outside-radius='+pixel(90,50)+'; color-property='+CSS.supports('color',value));Result
center=255,0,0; horizontal=0,0,255; vertical=0,0,255; outside-radius=0,0,255; color-property=false
The shown form and pixels were checked in Chromium 157.0.8103.51. Samples avoid the antialiased boundary; this does not test every newer color-space interpolation option.