feColorMatrix is an SVG filter that changes colors based on a transformation matrix. Every pixel's color value (represented by an [R,G,B,A] vector) is matrix multiplied to create a new color.
This filter is really powerful and allows granular per channel color manipulation. Una Kravets wrote an excellent article explaining how to use it.
This project aims to easily translate an RGBA value into an SVG color matrix.
Bare in mind you can do much more than this with the matrix, but if you want to colorize an SVG element following an exact RGBA value, then this converter will help you out.
This project makes use of the awesome polymer project.
rgba-matrix element has the following attributes:
<rgba-matrix r="1" g="1" b="1" a="1"></rgba-matrix>
The polymer element exposes a set matrix method for setting rgba values:
RGB Values will be converted to decimal from 0 to 255.
Will result in:
<rgba-matrix r="0.39" g="0.78" b="1.18" a="0.5"></rgba-matrix>
You’ll need npm to install the dev dependencies. First make sure you have node installed on your system.