SVG Example with RGBA
✓ Published0🌍 Public
This example demonstrates how SVG shapes can use RGBA colors to achieve opacity. Two rectangles are drawn on an SVG canvas using the `rect` element, with the first filled in solid red via `rgb(255, 0, 0)`. The second rectangle, partially overlapping the first, uses `rgba(0, 255, 0, 0.5)` to render green with 50% transparency, creating a blended color where the shapes intersect. The code uses a `<g>` element with a `transform` attribute for positioning, and the SVG is embedded directly in HTML.
AI-generated descriptionRGBA colors can specify opacity (alpha).
For example rgba(0, 255, 0, 0.5) means "make it green, with an opacity of 0.5 (50% transparent)".
From Intro to D3.
MIT Licensed