Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

repeating-radial-gradient() — repeating concentric color bands

`repeating-radial-gradient()` creates an `<image>` that repeats its color-stop segment across successive concentric circles or ellipses.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

repeating-radial-gradient( [ <radial-gradient-syntax> ] )

repeating-radial-gradient() creates an <image> that repeats its color-stop segment across successive concentric circles or ellipses.

For repeating-radial-gradient(circle at 50px 50px, red 0 10px, blue 10px 20px), radii 5, 15, 25, and 45 px yield 255,0,0,255, 0,0,255,255, 255,0,0,255, and 255,0,0,255; support is true. The samples demonstrate an actual radial period of 20px.

Grammar: repeating-radial-gradient( [ <radial-gradient-syntax> ] ).

at positions the center and circle or ellipse chooses geometry; extent keywords include closest-side and farthest-corner. At the current level, a circle percentage radius uses sqrt(width² + height²)/sqrt(2), while two-component circle 20px 30px is invalid for a circle. A 0px or unresolvably tiny period renders as the solid average color. The result has no natural size and can serve background-image.

Examples

const render=async(value,width,height,points)=>{const svg='<svg xmlns="http://www.w3.org/2000/svg" width="'+width+'" height="'+height+'"><foreignObject width="'+width+'" height="'+height+'"><div xmlns="http://www.w3.org/1999/xhtml" style="width:'+width+'px;height:'+height+'px;background-image:'+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=width;canvas.height=height;const context=canvas.getContext('2d');context.drawImage(image,0,0);return points.map(([x,y])=>[...context.getImageData(x,y,1,1).data].join(','))};
const value='repeating-radial-gradient(circle at 50px 50px, red 0 10px, blue 10px 20px)';
const pixels=await render(value,100,100,[[55,50],[65,50],[75,50],[95,50]]);
console.log('r5='+pixels[0]+'; r15='+pixels[1]+'; r25='+pixels[2]+'; r45='+pixels[3]+'; supported='+CSS.supports('background-image',value));

Result

r5=255,0,0,255; r15=0,0,255,255; r25=255,0,0,255; r45=255,0,0,255; supported=true

`repeating-radial-gradient()` creates an `<image>` that repeats its color-stop segment across successive concentric circles or ellipses.

Sources