soccer-jersey-fork 1.0.95 → 1.0.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,8 @@ export declare const drawSleeveTwoColors: (page: Svg, primaryColor: string, seco
13
13
  export declare const drawSleeveContrastingTwoColors: (page: Svg, primaryColor: string, secondaryColor: string) => import("@svgdotjs/svg.js").Pattern;
14
14
  export declare const drawSingleBand: (page: Svg, primaryColor: string, secondaryColor: string, bandStyle: StyleDirection) => import("@svgdotjs/svg.js").Pattern;
15
15
  export declare const drawSingleBandThin: (page: Svg, primaryColor: string, secondaryColor: string, bandStyle?: StyleDirection) => import("@svgdotjs/svg.js").Pattern;
16
- export declare const drawWaves: (page: Svg, primaryColor: string, secondaryColor: string, waveStyle: StyleDirection) => import("@svgdotjs/svg.js").Pattern;
16
+ export declare const drawWaves: (page: Svg, primaryColor: string, secondaryColor: string, direction: StyleDirection) => import("@svgdotjs/svg.js").Pattern;
17
+ export declare const drawConcentricCircles: (page: Svg, primaryColor: string, secondaryColor: string, direction: StyleDirection) => import("@svgdotjs/svg.js").Pattern;
17
18
  export declare const drawDashes: (page: Svg, primaryColor: string, secondaryColor: string, dashDirection: StyleDirection) => import("@svgdotjs/svg.js").Pattern;
18
19
  export declare const addShortSideColor: (page: Svg, color: string) => void;
19
20
  export declare function addShoulderSideColor(page: Svg, color: string): void;
@@ -156,9 +156,9 @@ export const drawSleeveTwoColors = (page, primaryColor, secondaryColor, directio
156
156
  });
157
157
  }
158
158
  default: {
159
- return page.pattern(29, 100, (add) => {
160
- add.rect(29, 100).fill(primaryColor);
161
- add.rect(18, 100).fill(secondaryColor).move(-4, 0);
159
+ return page.pattern(30, 100, (add) => {
160
+ add.rect(30, 100).fill(primaryColor);
161
+ add.rect(17, 100).fill(secondaryColor).move(-4, 0);
162
162
  });
163
163
  }
164
164
  }
@@ -229,7 +229,7 @@ export const drawSingleBandThin = (page, primaryColor, secondaryColor, bandStyle
229
229
  return drawVertical(60);
230
230
  }
231
231
  };
232
- export const drawWaves = (page, primaryColor, secondaryColor, waveStyle) => {
232
+ export const drawWaves = (page, primaryColor, secondaryColor, direction) => {
233
233
  function drawVertical() {
234
234
  return page.pattern(12, 20, function (add) {
235
235
  add.rect(12, 20).fill(primaryColor);
@@ -237,7 +237,7 @@ export const drawWaves = (page, primaryColor, secondaryColor, waveStyle) => {
237
237
  add.rect(6, 14).fill(secondaryColor).move(3, 9).rotate(15);
238
238
  });
239
239
  }
240
- switch (waveStyle) {
240
+ switch (direction) {
241
241
  case "horizontal":
242
242
  return page.pattern(20, 12, function (add) {
243
243
  add.rect(20, 12).fill(primaryColor);
@@ -252,6 +252,24 @@ export const drawWaves = (page, primaryColor, secondaryColor, waveStyle) => {
252
252
  return drawVertical();
253
253
  }
254
254
  };
255
+ export const drawConcentricCircles = (page, primaryColor, secondaryColor, direction) => {
256
+ switch (direction) {
257
+ default: {
258
+ return page.pattern(100, 100, function (add) {
259
+ add.rect(100, 100).fill(primaryColor);
260
+ const numberOfCircles = 12;
261
+ for (let i = 0; i < numberOfCircles; i++) {
262
+ const radius = 10 + i * 8;
263
+ add
264
+ .circle(radius)
265
+ .fill("none")
266
+ .stroke({ width: 1, color: secondaryColor })
267
+ .center(50, 50);
268
+ }
269
+ });
270
+ }
271
+ }
272
+ };
255
273
  export const drawDashes = (page, primaryColor,
256
274
  // Cannot do secondaryColor = "#eee" because empty string will not get to the default "#eee" in the parameter.
257
275
  secondaryColor, dashDirection) => {
@@ -291,22 +309,14 @@ export const addShortSideColor = (page, color) => {
291
309
  .stroke({ width: 2, color, linecap: "butt" });
292
310
  };
293
311
  export function addShoulderSideColor(page, color) {
294
- // page
295
- // .path(`m 2 35, l 16.5 -26, 19 -8`)
296
- // .fill("none")
297
- // .stroke({ width: 1, color, linecap: "butt" });
298
- // page
299
- // .path(`m 4 36, l 16.5 -25, 19 -8`)
300
- // .fill("none")
301
- // .stroke({ width: 1, color, linecap: "butt" });
302
312
  // left
303
313
  page
304
- .path(`m 0 35, l 16.5 -26, 19 -8`)
314
+ .path(`m 0 35, l 16.5 -26, 21 -8`)
305
315
  .fill("none")
306
316
  .stroke({ width: 2, color, linecap: "butt" });
307
317
  // right
308
318
  page
309
- .path(`m 102 35 l -16.5 -26, -21 -8`)
319
+ .path(`m 101 35 l -16.5 -26, -21 -8`)
310
320
  .fill("none")
311
321
  .stroke({ width: 2, color, linecap: "butt" });
312
322
  }
@@ -44,5 +44,5 @@ export interface DrawSoccerJerseyProps {
44
44
  withShorts?: boolean;
45
45
  }
46
46
  export type StyleDirection = "diagonalRight" | "diagonalLeft" | "horizontal" | "vertical" | "offsetLeftVertical" | "offsetRightVertical";
47
- export type ShirtStyle = "plain" | "twoColors" | "contrastingTwoColors" | "striped" | "stripedThin" | "stripedThick" | "waves" | "checkered" | "checkeredBig" | "diamonds" | "singleBandThin" | "singleBand" | "dashed" | "cross";
47
+ export type ShirtStyle = "plain" | "twoColors" | "contrastingTwoColors" | "concentricCircles" | "striped" | "stripedThin" | "stripedThick" | "waves" | "checkered" | "checkeredBig" | "diamonds" | "singleBandThin" | "singleBand" | "dashed" | "cross";
48
48
  export type SleeveStyle = ShirtStyle;
@@ -7,7 +7,7 @@
7
7
  /* eslint-disable max-len */
8
8
  import { SVG } from "@svgdotjs/svg.js";
9
9
  import lightenDarkenColor from "./lighten-darken-color";
10
- import { drawSingleBand, drawCheckered, drawTwoColors, drawWaves, drawDashes, addShoulderSideColor, addShortSideColor, addShirtSideColor, drawSingleBandThin, drawDiamonds, drawCrossLines, drawStriped, drawSleeveTwoColors, drawSleeveContrastingTwoColors, } from "../patterns/patterns";
10
+ import { addShirtSideColor, addShortSideColor, addShoulderSideColor, drawCheckered, drawConcentricCircles, drawCrossLines, drawDashes, drawDiamonds, drawSingleBand, drawSingleBandThin, drawSleeveContrastingTwoColors, drawSleeveTwoColors, drawStriped, drawTwoColors, drawWaves, } from "../patterns/patterns";
11
11
  /**
12
12
  * @param {object} specs Specifications of the soccer jersey.
13
13
  * @param {string} specs.shirtColor The main color (HTML Color Code) of
@@ -59,7 +59,7 @@ export default function drawSoccerJersey({ shirtColor = "plain", shirtStyle, shi
59
59
  /**
60
60
  * The points start from the left then spread out to the leftest
61
61
  */
62
- .path("m36 0.5 l -5 5 15 5 l 3 -5 2 0 3 5 15 -5 -4.3 -5 c -4 5 -26 5 -29 0")
62
+ .path("m36.5 0.5 l -6 5 15 9 l 3 -5 3 0 3 5 15 -9 -6 -5 c -10 10 -25 5 -27.5 0")
63
63
  .fill(collarColor || "#eee")
64
64
  .stroke({
65
65
  color: collarColor,
@@ -107,7 +107,7 @@ export default function drawSoccerJersey({ shirtColor = "plain", shirtStyle, shi
107
107
  }
108
108
  if (shirtBottomColor) {
109
109
  // const pathBottom = "m23 95 c 25 10 50 5 55 0";
110
- const pathBottom = "m23 94 c 5 8 50 6 55 0";
110
+ const pathBottom = "m23.5 94 c 5 7 50 7 54.5 0";
111
111
  page
112
112
  .path(pathBottom)
113
113
  .fill("none")
@@ -204,6 +204,9 @@ export default function drawSoccerJersey({ shirtColor = "plain", shirtStyle, shi
204
204
  }
205
205
  function getPatternFill(page, baseColor, style, styleColor, type, direction = "vertical") {
206
206
  switch (style) {
207
+ case "concentricCircles": {
208
+ return drawConcentricCircles(page, baseColor, styleColor, direction);
209
+ }
207
210
  case "twoColors": {
208
211
  if (type === "sleeve") {
209
212
  return drawSleeveTwoColors(page, baseColor, styleColor, direction);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soccer-jersey-fork",
3
- "version": "1.0.95",
3
+ "version": "1.0.97",
4
4
  "description": "Generate soccer jerseys in SVG format",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {