0

I have a simple hatching pattern:

<defs>                                
  <pattern id="pattern1" patternUnits="userSpaceOnUse"
           x="0" y="0" width="10" height="10"
           >
    <line x1="0" y1="0" x2="10" y2="10" stroke="black" />
    <line x1="0" y1="-10" x2="20" y2="10" stroke="black" />
    <line x1="-10" y1="0" x2="10" y2="20" stroke="black" />
  </pattern>
</defs>                               

<rect fill="url(#pattern1)" stroke="black" 
      x="100" y="100" width="200" height="100"/>

<rect fill="url(#pattern1)" stroke="red" 
      x="100" y="300" width="200" height="100"/>

Is there a way to set the color of the lines in the pattern when using it? For example, I'd like to set the color to red in second rect.

BradleyDotNET
  • 59,038
  • 10
  • 94
  • 113
radlan
  • 2,145
  • 4
  • 30
  • 47

1 Answers1

0

If you updated the colour in the pattern it would affect both rects. If you want different pattern colours in different rects you'll have to use different patterns.

Robert Longson
  • 110,343
  • 23
  • 240
  • 227