soccer-jersey-fork 1.0.97 → 1.0.100

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.
@@ -8,6 +8,7 @@ import { StyleDirection } from "../types";
8
8
  export declare const drawStriped: (page: Svg, primaryColor: string, secondaryColor: string, direction: StyleDirection, thickness?: "thin" | "thick" | "normal") => import("@svgdotjs/svg.js").Pattern;
9
9
  export declare const drawCheckered: (page: Svg, primaryColor: string, secondaryColor: string, size: "sm" | "lg", direction?: StyleDirection) => import("@svgdotjs/svg.js").Pattern;
10
10
  export declare const drawDiamonds: (page: Svg, primaryColor: string, secondaryColor: string) => import("@svgdotjs/svg.js").Pattern;
11
+ export declare const drawCrisscross: (page: Svg, primaryColor: string, secondaryColor: string) => import("@svgdotjs/svg.js").Pattern;
11
12
  export declare const drawTwoColors: (page: Svg, primaryColor: string, secondaryColor: string, bandStyle: StyleDirection) => import("@svgdotjs/svg.js").Pattern;
12
13
  export declare const drawSleeveTwoColors: (page: Svg, primaryColor: string, secondaryColor: string, direction: StyleDirection) => import("@svgdotjs/svg.js").Pattern;
13
14
  export declare const drawSleeveContrastingTwoColors: (page: Svg, primaryColor: string, secondaryColor: string) => import("@svgdotjs/svg.js").Pattern;
@@ -118,6 +118,15 @@ export const drawDiamonds = (page, primaryColor, secondaryColor) => {
118
118
  add.rect(3, 3).fill(secondaryColor).center(2, 2).rotate(45);
119
119
  });
120
120
  };
121
+ export const drawCrisscross = (page, primaryColor, secondaryColor) => {
122
+ return page.pattern(10, 10, (add) => {
123
+ add.rect(10, 10).fill(primaryColor);
124
+ // Diagonal line from top-left to bottom-right of the tile
125
+ add.line(0, 0, 10, 10).stroke({ color: secondaryColor, width: 1 });
126
+ // Diagonal line from top-right to bottom-left of the tile
127
+ add.line(10, 0, 0, 10).stroke({ color: secondaryColor, width: 1 });
128
+ });
129
+ };
121
130
  export const drawTwoColors = (page, primaryColor, secondaryColor, bandStyle) => {
122
131
  switch (bandStyle) {
123
132
  case "diagonalRight":
@@ -285,13 +294,21 @@ secondaryColor, dashDirection) => {
285
294
  add.rect(5, 2).fill(secondaryColor).move(5, 5).rotate(135);
286
295
  });
287
296
  case "horizontal":
288
- return page.pattern(10, 10, function (add) {
297
+ return page.pattern(10, 10, (add) => {
289
298
  add.rect(10, 10).fill(primaryColor);
290
299
  add.rect(5, 2).fill(secondaryColor);
291
300
  add.rect(5, 2).fill(secondaryColor).move(5, 5);
292
301
  });
302
+ // default:
303
+ // return page.pattern(25, 15, (add) => {
304
+ // add.rect(25, 15).fill(primaryColor);
305
+ // add.rect(5, 2).fill(secondaryColor).move(0, 5).rotate(135);
306
+ // add.rect(5, 2).fill(secondaryColor).move(5, 5).rotate(135);
307
+ // add.rect(5, 2).fill(secondaryColor).move(15, 5).rotate(45);
308
+ // add.rect(5, 2).fill(secondaryColor).move(20, 5).rotate(45);
309
+ // });
293
310
  default:
294
- return page.pattern(10, 10, function (add) {
311
+ return page.pattern(10, 10, (add) => {
295
312
  add.rect(10, 10).fill(primaryColor);
296
313
  add.rect(2, 5).fill(secondaryColor);
297
314
  add.rect(2, 5).fill(secondaryColor).move(5, 5);
@@ -311,7 +328,7 @@ export const addShortSideColor = (page, color) => {
311
328
  export function addShoulderSideColor(page, color) {
312
329
  // left
313
330
  page
314
- .path(`m 0 35, l 16.5 -26, 21 -8`)
331
+ .path(`m 0 35, l 16.5 -26, 20 -8`)
315
332
  .fill("none")
316
333
  .stroke({ width: 2, color, linecap: "butt" });
317
334
  // right
@@ -10,13 +10,12 @@ export default meta;
10
10
  export const Default = {
11
11
  args: {
12
12
  shirtColor: "#d40410",
13
- sleeveColor: "#ffffff",
13
+ sleeveColor: "#773838",
14
14
  shirtStyle: "striped",
15
15
  shirtStyleColor: "#DA000C",
16
16
  shirtBottomColor: "",
17
17
  shirtStyleDirection: "vertical",
18
18
  collarColor: "",
19
- sleeveStyle: "twoColors",
20
19
  sleeveStyleColor: "#DA000C",
21
20
  sleeveStyleDirection: "horizontal",
22
21
  sleeveCuffColor: "",
@@ -27,6 +26,5 @@ export const Default = {
27
26
  shirtSideColor: "",
28
27
  shortsSideColor: "#b3020c",
29
28
  shoulderSideColor: "",
30
- withBadge: true,
31
29
  },
32
30
  };
@@ -40,9 +40,8 @@ export interface DrawSoccerJerseyProps {
40
40
  shortsSideColor?: string;
41
41
  shortsCuffColor?: string;
42
42
  shoulderSideColor?: string;
43
- withBadge?: boolean;
44
43
  withShorts?: boolean;
45
44
  }
46
45
  export type StyleDirection = "diagonalRight" | "diagonalLeft" | "horizontal" | "vertical" | "offsetLeftVertical" | "offsetRightVertical";
47
- export type ShirtStyle = "plain" | "twoColors" | "contrastingTwoColors" | "concentricCircles" | "striped" | "stripedThin" | "stripedThick" | "waves" | "checkered" | "checkeredBig" | "diamonds" | "singleBandThin" | "singleBand" | "dashed" | "cross";
46
+ export type ShirtStyle = "plain" | "twoColors" | "contrastingTwoColors" | "concentricCircles" | "striped" | "stripedThin" | "stripedThick" | "waves" | "checkered" | "checkeredBig" | "diamonds" | "singleBandThin" | "singleBand" | "dashed" | "cross" | "crisscross";
48
47
  export type SleeveStyle = ShirtStyle;
@@ -18,4 +18,4 @@ import { DrawSoccerJerseyProps } from "../types";
18
18
  * @return {string} A data URL ready for direct use as src attribute
19
19
  * on <img />
20
20
  */
21
- export default function drawSoccerJersey({ shirtColor, shirtStyle, shirtStyleColor, shirtStyleDirection, shirtWidth, shoulderSideColor, shirtSideColor, shirtBottomColor, sleeveColor, sleeveCuffColor, sleeveStyleColor, sleeveStyle, sleeveStyleDirection, collarColor, collarType, shortsColor, shortsCuffColor, shortsSideColor, images, texts, withBadge, withShorts, isBack, }: DrawSoccerJerseyProps): string;
21
+ export default function drawSoccerJersey({ shirtColor, shirtStyle, shirtStyleColor, shirtStyleDirection, shirtWidth, shoulderSideColor, shirtSideColor, shirtBottomColor, sleeveColor, sleeveCuffColor, sleeveStyleColor, sleeveStyle, sleeveStyleDirection, collarColor, collarType, shortsColor, shortsCuffColor, shortsSideColor, images, texts, withShorts, isBack, }: DrawSoccerJerseyProps): string;
@@ -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 { addShirtSideColor, addShortSideColor, addShoulderSideColor, drawCheckered, drawConcentricCircles, drawCrossLines, drawDashes, drawDiamonds, drawSingleBand, drawSingleBandThin, drawSleeveContrastingTwoColors, drawSleeveTwoColors, drawStriped, drawTwoColors, drawWaves, } from "../patterns/patterns";
10
+ import { addShirtSideColor, addShortSideColor, addShoulderSideColor, drawCheckered, drawConcentricCircles, drawCrisscross, 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
@@ -27,7 +27,7 @@ import { addShirtSideColor, addShortSideColor, addShoulderSideColor, drawChecker
27
27
  * @return {string} A data URL ready for direct use as src attribute
28
28
  * on <img />
29
29
  */
30
- export default function drawSoccerJersey({ shirtColor = "plain", shirtStyle, shirtStyleColor, shirtStyleDirection, shirtWidth = 200, shoulderSideColor, shirtSideColor, shirtBottomColor, sleeveColor = shirtColor, sleeveCuffColor, sleeveStyleColor, sleeveStyle, sleeveStyleDirection, collarColor, collarType, shortsColor, shortsCuffColor, shortsSideColor, images, texts, withBadge, withShorts = true, isBack = false, }) {
30
+ export default function drawSoccerJersey({ shirtColor = "plain", shirtStyle, shirtStyleColor, shirtStyleDirection, shirtWidth = 200, shoulderSideColor, shirtSideColor, shirtBottomColor, sleeveColor = shirtColor, sleeveCuffColor, sleeveStyleColor, sleeveStyle, sleeveStyleDirection, collarColor, collarType, shortsColor, shortsCuffColor, shortsSideColor, images, texts, withShorts = true, isBack = false, }) {
31
31
  // paths
32
32
  const pathLeftSleeve = "m18 8.5c-4 3-6.1 7.7-8.9 12-3.1 4.9-6 9.9-8.8 15 6 4 12 8.2 19 10 4.1.38 4.3-5.3 3.8-8.2-.29-9.7-3-19-5-29z";
33
33
  const pathRightSleeve = "m83 8.1c4 3 6.1 7.7 8.9 12 3.1 4.9 6 9.9 8.8 15-6 4-12 8.2-19 10-4.1.38-4.3-5.3-3.8-8.2.3-9.7 3-19 5-29z";
@@ -77,9 +77,6 @@ export default function drawSoccerJersey({ shirtColor = "plain", shirtStyle, shi
77
77
  }
78
78
  }
79
79
  }
80
- if (withBadge) {
81
- page.circle(8).fill(lightenDarkenColor(shirtColor, 60)).move(64, 25);
82
- }
83
80
  }
84
81
  const optimizedSleeveColor = lightenDarkenColor(sleeveColor, -5);
85
82
  sleeveStyleColor = sleeveStyleColor || "#eee";
@@ -239,6 +236,8 @@ function getPatternFill(page, baseColor, style, styleColor, type, direction = "v
239
236
  return drawWaves(page, baseColor, styleColor, direction);
240
237
  case "cross":
241
238
  return drawCrossLines(page, baseColor, styleColor);
239
+ case "crisscross":
240
+ return drawCrisscross(page, baseColor, styleColor);
242
241
  default:
243
242
  return baseColor;
244
243
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soccer-jersey-fork",
3
- "version": "1.0.97",
3
+ "version": "1.0.100",
4
4
  "description": "Generate soccer jerseys in SVG format",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {