SVG flood-color Attribute

Last Updated : 31 Mar, 2022

The flood-color attribute indicates what color is used to flood the current filter primitive subregion.

Syntax:

flood-color="color"

Attribute Values:

  • color: The color that we want to flood.

We will use the flood-color attribute for setting the flood color.

Example 1:

html
<!DOCTYPE html>
<html>

<body>
    <svg viewBox="0 0 4000 2000" 
        xmlns="http://www.w3.org/2000/svg">
        
        <filter id="flood1">
            <feFlood flood-color="green" />
        </filter>

        <rect x="100" y="100" width="800" 
            height="800" style=
            "filter: url(#flood1);" />
    </svg>
</body>

</html>

Output:

Example 2: 

html
<!DOCTYPE html>
<html>

<body>
    <svg viewBox="0 0 400 100" 
        xmlns="http://www.w3.org/2000/svg">
        
        <circle cx="50" cy="50" r="35" 
            flood-color="black" />
    </svg>
</body>

</html>

Output:

Comment