@@ -116,21 +116,21 @@ Creates a pattern that can be used in SVG or Canvas.
116116
117117#### Options
118118
119- | Option | Type | Default | Description |
120- | -------------- | -------- | --------------- | --------------------------------------------------------------------------------------------------- |
121- | ` type ` | string | ` "line" ` | Pattern type: "line", "plaid", "circle", "plus", "cross", "triangle", "square", "diamond", "custom" |
122- | ` scale ` | number | ` 1 ` | Scale of the tile (multiplier) |
123- | ` size ` | number | ` 20 ` | Shape size as a percentage of tile area (0-100) |
124- | ` angle ` | number | ` 0 ` | Rotation angle in degrees (0-360) |
125- | ` fill ` | string | ` "black" ` | Fill color (CSS color) |
126- | ` stroke ` | string | ` "transparent" ` | Stroke color (CSS color) |
127- | ` strokeWidth ` | number | ` 0 ` | Stroke width in pixels |
128- | ` dash ` | number[ ] | ` [] ` | Dash pattern for stroke (e.g., ` [5, 5] ` ) |
129- | ` background ` | string | ` "white" ` | Background color of the pattern tile |
130- | ` border ` | number | ` 0 ` | Border width around tile edges |
131- | ` patchSize ` | boolean | ` false ` | Intelligently swap foreground/background for better appearance at high sizes |
132- | ` custom.shape ` | function | - | Custom shape function (for type: "custom") |
133- | ` custom.patch ` | number | ` 50 ` | Patch size for custom shapes |
119+ | Option | Type | Default | Description |
120+ | -------------- | -------- | --------------- | ---------------------------------------------------------------------------------------------------------------- |
121+ | ` type ` | string | ` "line" ` | Pattern type: "line", "plaid", "circle", "plus", "cross", "triangle", "square", "diamond", "dithering", " custom" |
122+ | ` scale ` | number | ` 1 ` | Scale of the tile (multiplier) |
123+ | ` size ` | number | ` 20 ` | Shape size as a percentage of tile area (0-100) |
124+ | ` angle ` | number | ` 0 ` | Rotation angle in degrees (0-360) |
125+ | ` fill ` | string | ` "black" ` | Fill color (CSS color) |
126+ | ` stroke ` | string | ` "transparent" ` | Stroke color (CSS color) |
127+ | ` strokeWidth ` | number | ` 0 ` | Stroke width in pixels |
128+ | ` dash ` | number[ ] | ` [] ` | Dash pattern for stroke (e.g., ` [5, 5] ` ) |
129+ | ` background ` | string | ` "white" ` | Background color of the pattern tile |
130+ | ` border ` | number | ` 0 ` | Border width around tile edges |
131+ | ` patchSize ` | boolean | ` false ` | Intelligently swap foreground/background for better appearance at high sizes |
132+ | ` custom.shape ` | function | - | Custom shape function (for type: "custom") |
133+ | ` custom.patch ` | number | ` 50 ` | Patch size for custom shapes |
134134
135135#### Return Value
136136
@@ -211,6 +211,14 @@ motif({ type: "square", size: 25 });
211211motif ({ type: " diamond" , size: 25 });
212212```
213213
214+ ### Dithering
215+
216+ Dithering pattern. Due to the 4x4 Bayer matrix, the ` size ` option is limited to only 16 values/steps (multiples of 4).
217+
218+ ``` typescript
219+ motif ({ type: " dithering" , scale: 2 , size: 30 });
220+ ```
221+
214222### Custom
215223
216224Define your own pattern shape
0 commit comments