Compare commits

..
3 changed files with 192 additions and 186 deletions

View file

@ -24,20 +24,13 @@ For example this SVG will be be a rectangle (`<rect>` tag) of 100 pixels width a
</svg>
```
Colors are automatically defined by two CSS rules: the color value of the text (aka currentColor) and the background value on the div containing them (if none, the <body>).
Two patterns (seigaiha and yinyang) default to a white background, which can be changed by using a css custom property.
```css
#seigaiha, #yinyang {
--background: red;
}
```
Almost all SVG patterns come with no colors defined, which means colors will be automatically defined by two CSS rules: the `color` value and the `background` value on your `<body>` element.
If you change those colors (for themes or dark mode), the patterns colors will change too accordingly.
## CSS Version
The CSS version is deprecated, and uses the SVGs as base64 background images. Include the classname to your existing html element and the pattern should appear. Please note that since this is a base64 encoding, you cannot change the colors when using the CSS version.
The CSS version uses the SVGs as base64 background images. Just include the classname to your existing html element and the pattern should appear. Please note that since this is a base64 encoding, you cannot change the colors when using the CSS version.
## License

103
dist/moyo.svg vendored
View file

@ -5,7 +5,7 @@
<rect x="5" y="5" width="5" height="5" fill="currentColor" />
</pattern>
<pattern id="checks-diagonal" patternUnits="userSpaceOnUse" width="10" height="10">
<polygon points="5,0 10,5 5,10 0,5" fill="currentColor"/>
<polygon x="0" y="0" points="5,0 10,5 5,10 0,5" fill="currentColor" />
</pattern>
<pattern id="grid" patternUnits="userSpaceOnUse" width="4" height="4">
<rect x="0" y="2" width="4" height="1" fill="currentColor" />
@ -64,47 +64,53 @@
<polygon points="16,8 8,16 16,16" fill="currentColor" />
</pattern>
<pattern id="triangles" patternUnits="userSpaceOnUse" width="10" height="10">
<polygon points="0,0 10,10 0,10" fill="currentColor"/>
<polygon x="-1" points="0,0 10,10 0,10" fill="currentColor" />
</pattern>
<pattern id="quarter-circles" patternUnits="userSpaceOnUse" width="10" height="10">
<circle cx="11" cy="11" r="10" fill="currentColor" />
</pattern>
<pattern id="seigaiha" patternUnits="userSpaceOnUse" width="48" height="20">
<circle cx="-4" cy="10" stroke-width="2" r="20" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="-4" cy="10" stroke-width="2" r="16" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="-4" cy="10" stroke-width="2" r="12" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="-4" cy="10" stroke-width="2" r="8" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="-4" cy="10" stroke-width="2" r="4" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="44" cy="10" stroke-width="2" r="20" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="44" cy="10" stroke-width="2" r="16" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="44" cy="10" stroke-width="2" r="12" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="44" cy="10" stroke-width="2" r="8" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="44" cy="10" stroke-width="2" r="4" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="20" cy="20" stroke-width="2" r="20" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="20" cy="20" stroke-width="2" r="16" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="20" cy="20" stroke-width="2" r="12" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="20" cy="20" stroke-width="2" r="8" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="20" cy="20" stroke-width="2" r="4" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="-4" cy="30" stroke-width="2" r="20" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="-4" cy="30" stroke-width="2" r="16" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="-4" cy="30" stroke-width="2" r="12" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="-4" cy="30" stroke-width="2" r="8" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="-4" cy="30" stroke-width="2" r="4" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="44" cy="30" stroke-width="2" r="20" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="44" cy="30" stroke-width="2" r="16" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="44" cy="30" stroke-width="2" r="12" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="44" cy="30" stroke-width="2" r="8" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="44" cy="30" stroke-width="2" r="4" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="20" cy="40" stroke-width="2" r="20" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="20" cy="40" stroke-width="2" r="16" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="20" cy="40" stroke-width="2" r="12" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="20" cy="40" stroke-width="2" r="8" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="20" cy="40" stroke-width="2" r="4" fill="var(--background, white)" stroke="currentColor"/>
<circle cx="-4" cy="10" stroke-width="2" r="20" fill="white" stroke="black" />
<circle cx="-4" cy="10" stroke-width="2" r="16" fill="white" stroke="black" />
<circle cx="-4" cy="10" stroke-width="2" r="12" fill="white" stroke="black" />
<circle cx="-4" cy="10" stroke-width="2" r="8" fill="white" stroke="black" />
<circle cx="-4" cy="10" stroke-width="2" r="4" fill="white" stroke="black" />
<circle cx="44" cy="10" stroke-width="2" r="20" fill="white" stroke="black" />
<circle cx="44" cy="10" stroke-width="2" r="16" fill="white" stroke="black" />
<circle cx="44" cy="10" stroke-width="2" r="12" fill="white" stroke="black" />
<circle cx="44" cy="10" stroke-width="2" r="8" fill="white" stroke="black" />
<circle cx="44" cy="10" stroke-width="2" r="4" fill="white" stroke="black" />
<circle cx="20" cy="20" stroke-width="2" r="20" fill="white" stroke="black" />
<circle cx="20" cy="20" stroke-width="2" r="16" fill="white" stroke="black" />
<circle cx="20" cy="20" stroke-width="2" r="12" fill="white" stroke="black" />
<circle cx="20" cy="20" stroke-width="2" r="8" fill="white" stroke="black" />
<circle cx="20" cy="20" stroke-width="2" r="4" fill="white" stroke="black" />
<circle cx="-4" cy="30" stroke-width="2" r="20" fill="white" stroke="black" />
<circle cx="-4" cy="30" stroke-width="2" r="16" fill="white" stroke="black" />
<circle cx="-4" cy="30" stroke-width="2" r="12" fill="white" stroke="black" />
<circle cx="-4" cy="30" stroke-width="2" r="8" fill="white" stroke="black" />
<circle cx="-4" cy="30" stroke-width="2" r="4" fill="white" stroke="black" />
<circle cx="44" cy="30" stroke-width="2" r="20" fill="white" stroke="black" />
<circle cx="44" cy="30" stroke-width="2" r="16" fill="white" stroke="black" />
<circle cx="44" cy="30" stroke-width="2" r="12" fill="white" stroke="black" />
<circle cx="44" cy="30" stroke-width="2" r="8" fill="white" stroke="black" />
<circle cx="44" cy="30" stroke-width="2" r="4" fill="white" stroke="black" />
<circle cx="20" cy="40" stroke-width="2" r="20" fill="white" stroke="black" />
<circle cx="20" cy="40" stroke-width="2" r="16" fill="white" stroke="black" />
<circle cx="20" cy="40" stroke-width="2" r="12" fill="white" stroke="black" />
<circle cx="20" cy="40" stroke-width="2" r="8" fill="white" stroke="black" />
<circle cx="20" cy="40" stroke-width="2" r="4" fill="white" stroke="black" />
</pattern>
<pattern id="wave" patternUnits="userSpaceOnUse" width="18" height="18">
<path fill="none" stroke="currentColor" d="M0,18 C 5,15 5,2 10,5 S 14,18 18,18" />
</pattern>
<pattern id="yinyang" patternUnits="userSpaceOnUse" width="20" height="20">
<pattern id="yinyang" patternUnits="userSpaceOnUse" width="20" height="20" bacl>
<clipPath id="cut-off-left1">
<rect x="0" y="0" width="5" height="10" />
</clipPath>
@ -112,24 +118,26 @@
<rect x="5" y="0" width="5" height="10" />
</clipPath>
<rect width="20" height="20" fill="currentColor" opacity="0.5" />
<circle cx="5" cy="5" r="5" fill="var(--background, white)" stroke="none" clip-path="url(#cut-off-left1)"/>
<circle cx="5" cy="5" r="5" fill="currentColor" stroke="none" clip-path="url(#cut-off-right1)"/>
<circle cx="5" cy="2.5" r="2.5" fill="var(--background, white)" stroke="none"/>
<circle cx="5" cy="7.5" r="2.5" fill="currentColor" stroke="none"/>
<circle cx="5" cy="2.5" r="1" fill="currentColor" stroke="none"/>
<circle cx="5" cy="7.5" r="1" fill="var(--background, white)" stroke="none"/>
<circle cx="5" cy="5" r="5" fill="white" stroke="none" clip-path="url(#cut-off-left1)" />
<circle cx="5" cy="5" r="5" fill="black" stroke="none" clip-path="url(#cut-off-right1)" />
<circle cx="5" cy="2.5" r="2.5" fill="white" stroke="none" />
<circle cx="5" cy="7.5" r="2.5" fill="black" stroke="none" />
<circle cx="5" cy="2.5" r="1" fill="black" stroke="none" />
<circle cx="5" cy="7.5" r="1" fill="white" stroke="none" />
<clipPath id="cut-off-left2">
<rect x="10" y="10" width="5" height="10" />
</clipPath>
<clipPath id="cut-off-right2">
<rect x="15" y="10" width="5" height="10" />
</clipPath>
<circle cx="15" cy="15" r="5" fill="var(--background, white)" stroke="none" clip-path="url(#cut-off-left2)"/>
<circle cx="15" cy="15" r="5" fill="currentColor" stroke="none" clip-path="url(#cut-off-right2)"/>
<circle cx="15" cy="12.5" r="2.5" fill="var(--background, white)" stroke="none"/>
<circle cx="15" cy="17.5" r="2.5" fill="currentColor" stroke="none"/>
<circle cx="15" cy="12.5" r="1" fill="currentColor" stroke="none"/>
<circle cx="15" cy="17.5" r="1" fill="var(--background, white)" stroke="none"/>
<circle cx="15" cy="15" r="5" fill="white" stroke="none" clip-path="url(#cut-off-left2)" />
<circle cx="15" cy="15" r="5" fill="black" stroke="none" clip-path="url(#cut-off-right2)" />
<circle cx="15" cy="12.5" r="2.5" fill="white" stroke="none" />
<circle cx="15" cy="17.5" r="2.5" fill="black" stroke="none" />
<circle cx="15" cy="12.5" r="1" fill="black" stroke="none" />
<circle cx="15" cy="17.5" r="1" fill="white" stroke="none" />
</pattern>
<pattern id="circles-small" patternUnits="userSpaceOnUse" width="10" height="10">
<circle cx="5" cy="5" r="1" fill="currentColor" stroke="currentColor" />
@ -139,6 +147,7 @@
</pattern>
<pattern id="circles-large" patternUnits="userSpaceOnUse" width="10" height="10">
<circle cx="5" cy="5" r="4.5" fill="none" stroke="currentColor" />
</pattern>
<pattern id="stars" patternUnits="userSpaceOnUse" width="20" height="20">
<rect x="2.5" y="5" width="6" height="1" fill="currentColor" />
@ -155,12 +164,16 @@
<pattern id="paper" patternUnits="userSpaceOnUse" width="20" height="20">
<rect x="0" y="0" width="20" height="1.5" fill="currentColor" />
<rect x="0" y="0" width="1.5" height="20" fill="currentColor" />
<rect x="0" y="4" width="20" height="1" fill="currentColor" opacity="0.5" />
<rect x="4" y="0" width="1" height="20" fill="currentColor" opacity="0.5" />
<rect x="0" y="8" width="20" height="1" fill="currentColor" opacity="0.5" />
<rect x="8" y="0" width="1" height="20" fill="currentColor" opacity="0.5" />
<rect x="0" y="12" width="20" height="1" fill="currentColor" opacity="0.5" />
<rect x="12" y="0" width="1" height="20" fill="currentColor" opacity="0.5" />
<rect x="0" y="16" width="20" height="1" fill="currentColor" opacity="0.5" />
<rect x="16" y="0" width="1" height="20" fill="currentColor" opacity="0.5" />
</pattern>

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before After
Before After

View file

@ -131,7 +131,7 @@ const patterns = [
<path fill="none" stroke="currentColor" d="M0,18 C 5,15 5,2 10,5 S 14,18 18,18" />
</pattern>`,
`<pattern id="yinyang" patternUnits="userSpaceOnUse" width="20" height="20">
`<pattern id="yinyang" patternUnits="userSpaceOnUse" width="20" height="20" bacl>
<clipPath id="cut-off-left1">
<rect x="0" y="0" width="5" height="10" />
</clipPath>