This example demonstrates using keyword values for fill.
HTML
We include three <path> elements and a <marker> element that adds a <circle> to every path point. We set the circle marker to be black with a grey fill with the SVG stroke and fill attributes.
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 90">
<path d="M 10 44.64 L 30 10 L 70 10 L 90 44.64 L 70 79.28 L 30 79.28 Z" />
<path d="M 100 44.64 L 80 10 L 120 10 L 140 44.64 L 120 79.28 L 80 79.28 Z" />
<path
d="M 150 44.64 L 130 10 L 170 10 L 190 44.64 L 170 79.28 L 130 79.28 Z" />
<marker
id="circle"
markerWidth="12"
markerHeight="12"
refX="6"
refY="6"
markerUnits="userSpaceOnUse">
<circle cx="6" cy="6" r="3" stroke-width="2" stroke="black" fill="grey" />
</marker>
</svg>
CSS
We set different stroke and fill colors on each path. The first path, the one with a red border, has its fill set to none. We set the circle marker's stroke and fill to the same color as the stroke of the element they're marking, using the context-stroke value.
path {
stroke-width: 2px;
marker: url(#circle);
}
path:nth-of-type(1) {
stroke: red;
fill: none;
}
path:nth-of-type(2) {
stroke: green;
fill: lightgreen;
}
path:nth-of-type(3) {
stroke: blue;
fill: lightblue;
}
circle {
stroke: context-stroke;
fill: context-stroke;
}
Results
Note how the first path has a transparent background because the fill is none, overriding the default fill of black. The circles are filled with the color of the stroke. If you change the value to context-fill, the circles will be transparent, lightgreen and lightblue instead of red, green, and blue.