SVG Palette

Parse an SVG to discover which colors it contains.


require "svg_palette"

#=> [RGB [#006a4e], RGB [#ffce00], RGB [#d21034], RGB [#ffffff]]

The array contains instances of Color.

Note: The color black may not be detected unless it is explictly set as a property value.


The following properties are considered:

fill stroke stop-color flood-color lighting-color style

When checking style rules, only the keys for those properties are considered, e.g:

<foo style="fill:red"></foo>