]> git.openstreetmap.org Git - rails.git/blob - app/helpers/svg_helper.rb
Add solid svg image helper
[rails.git] / app / helpers / svg_helper.rb
1 module SvgHelper
2   def solid_svg_image_tag(width, height, fill, **options)
3     svg = "<svg xmlns='http://www.w3.org/2000/svg' width='#{width}' height='#{height}'>" \
4           "<rect width='100%' height='100%' fill='#{fill}' />" \
5           "</svg>"
6     image_tag "data:image/svg+xml,#{u(svg)}", **options
7   end
8 end