soccer-jersey-fork 1.0.119 → 1.0.120

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.
@@ -16,7 +16,7 @@ export interface DrawSoccerJerseyProps {
16
16
  shirtBottomColor?: string;
17
17
  shirtStyleDirection?: StyleDirection;
18
18
  shirtWidth?: number;
19
- collarType?: "round" | "polo" | "classic";
19
+ collarType?: "round" | "polo" | "classic" | "v-neck";
20
20
  collarColor?: string;
21
21
  sleeveCuffColor?: string;
22
22
  sleeveType: "long" | "short";
@@ -173,42 +173,38 @@ export default function drawSoccerJersey({ shirtColor = "plain", shirtStyle, shi
173
173
  drawText(page);
174
174
  }
175
175
  }
176
- /**
177
- * The collar should be the last so the shoulder color doesn't superimpose it.
178
- */
176
+ const POLO_COLLAR_PATH = "M 36.26 0.02 l -6 5 15 9 4.44 -6.68 -0.13 -0.48 4.68 7.16 15 -9 -6 -5 c -10 10 -25 5 -27.5 0";
177
+ const CLASSIC_COLLAR_PATH = "m36 0 l-6 10 q5-6 22 0 z m29 0 l6 10 q-5-6-22 0 z";
178
+ const VNECK_COLLAR_PATH = "M 36.1 0.24 C 36.34 1.22 50.52 9.03 50.52 9.03 L 64.46 0.48 66.87 1.65 C 64.72 3.46 63.7 4.38 60.84 6.1 C 57.34 8.2 54.24 10.01 50.76 12.5 L 32.73 2.04 Z";
179
+ const ROUND_COLLAR_PATH = "m35 0 q 17 20 30 0";
180
+ const fillColor = collarColor || "#eeeeee";
179
181
  switch (collarType) {
180
- case "polo": {
182
+ case "polo":
181
183
  page
182
- /**
183
- * The points start from the left then spread out to the leftest
184
- */
185
- .path("M 36.26 0.02 l -6 5 15 9 4.44 -6.68 -0.13 -0.48 4.68 7.16 15 -9 -6 -5 c -10 10 -25 5 -27.5 0")
186
- .fill(collarColor || "#eee")
187
- .stroke({
188
- color: collarColor,
189
- width: 1,
190
- });
184
+ .path(POLO_COLLAR_PATH)
185
+ .fill(fillColor)
186
+ .stroke({ color: fillColor, width: 1, linejoin: "round" });
191
187
  break;
192
- }
193
- case "classic": {
188
+ case "classic":
194
189
  page
195
- .path("m36 0 l-6 10 q5-6 22 0 z m29 0 l6 10 q-5-6-22 0 z")
196
- .fill(collarColor || "#eee")
197
- .stroke({
198
- color: collarColor,
199
- width: 1,
200
- });
190
+ .path(CLASSIC_COLLAR_PATH)
191
+ .fill(fillColor)
192
+ .stroke({ color: fillColor, width: 1, linejoin: "round" });
193
+ break;
194
+ case "v-neck":
195
+ page
196
+ .path(VNECK_COLLAR_PATH)
197
+ .fill(fillColor)
198
+ .stroke({ color: fillColor, width: 1, linejoin: "round" });
199
+ break;
200
+ case "round":
201
+ default:
202
+ // Round collars use an open-stroke line variant instead of a closed shape fill
203
+ page
204
+ .path(ROUND_COLLAR_PATH)
205
+ .fill("none")
206
+ .stroke({ color: fillColor, width: 2, linecap: "round" });
201
207
  break;
202
- }
203
- default: {
204
- if (collarColor) {
205
- const pathCollar = "m35 0 q 17 20 30 0";
206
- page
207
- .path(pathCollar)
208
- .fill("none")
209
- .stroke({ color: collarColor, width: 2 });
210
- }
211
- }
212
208
  }
213
209
  page.width(shirtWidth);
214
210
  // +10 is some extra room with the shorts height, so the total should be 150
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soccer-jersey-fork",
3
- "version": "1.0.119",
3
+ "version": "1.0.120",
4
4
  "description": "Generate soccer jerseys in SVG format",
5
5
  "main": "lib/index.js",
6
6
  "author": "nadchif (https://github.com/nadchif)",