SVG <feColorMatrix> Filter

You are Here:

Whis is <feColorMatrix> Filter?

The <feColorMatrix> SVG filter element changes colors based on a transformation matrix.

Example

HTML Online Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> svg rect{ stroke:red; stroke-width:3; fill:#339933; } </style> </head> <body> <svg height="130" width="130"> <defs> <filter id="point" x="0" y="0" width="200%" height="200%"> <feOffset result="offOut" in="SourceGraphic" dx="20" dy="20" /> <feColorMatrix result="matrixOut" in="offOut" type="saturate" values="1"/> <feGaussianBlur result="blurOut" in="matrixOut" stdDeviation="10" /> <feBlend in="SourceGraphic" in2="blurOut" mode="normal" /> </filter> </defs> <rect width="80" height="80" filter="url(#point)" /> </svg> </body> </html>

Attributes Value

AttributeExplanation
inSpecifies the input for the given filter primitive.
typeSpecifies the type of matrix operation.
The following are the list of possible value
  • matrix
  • saturate
  • hueRotate
  • luminanceToAlpha
valuesThe values attribute is a semicolon-separated list of one or more values. The values attribute in feColorMatrix are always depends upon the type attribute value used.
The following are the list of possible values depends upon type attributes value
  • matrix - values is a list of 20 matrix values (a00 a01 a02 a03 a04 a10 a11 ... a34), separated by whitespace and/or a comma.
  • saturate - values is a single real number value (0 to 1).
  • hueRotate - values is a single one real number value (degrees).
  • luminanceToAlpha - values is not applicable.

Reminder

Hi Developers, we almost covered 91% of SVG Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in SVG.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author