1

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
  • 60,462
  • 10
  • 96
  • 117
radlan
  • 2,393
  • 4
  • 33
  • 53

1 Answers1

1

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
  • 118,664
  • 26
  • 252
  • 242