generate functionMon, 06 Mar 2023

<svg viewBox="0 0 29 29" {...props}> <g fillRule="evenodd"> <circle cx="14.5" cy="14.5" r="14.5" fill="#F34910"/> <path fill="#C33D11" d="M13 9h3v11h-3z"/> <path fill="#C33D11" d="M20 13v3H9v-3z"/> </g> </svg> generate template with this svg custom color for circle with rgb(74, 0, 255)

require "erb" class Svg < ERB def initialize(filename) @filename = filename end def render(custom_color) ERB.new(File.read(@filename)).result(binding) end end custom_color = "rgb(74, 0, 255)" puts Svg.new("./my_svg.erb").render(custom_color)

Questions about programming?Chat with your personal AI assistant