soccer-jersey-fork 1.0.48 → 1.0.49
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.
|
@@ -17,3 +17,4 @@ export declare const drawSingleBand: (page: Svg, primaryColor: string, secondary
|
|
|
17
17
|
export declare const drawWaves: (page: Svg, primaryColor: string, secondaryColor: string, waveStyle: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
|
|
18
18
|
export declare const drawDashes: (page: Svg, primaryColor: string, secondaryColor: string, dashDirection: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
|
|
19
19
|
export declare const drawShortsSideStriped: (page: Svg, primaryColor: string, secondaryColor: string) => import("@svgdotjs/svg.js").Pattern;
|
|
20
|
+
export declare function addShoulderStriped(page: Svg, color: string): void;
|
package/lib/patterns/patterns.js
CHANGED
|
@@ -246,13 +246,6 @@ export const drawDashes = (page, primaryColor, secondaryColor, dashDirection) =>
|
|
|
246
246
|
});
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
|
-
// export const drawShortsSideStriped = (page: Svg, color: string) => {
|
|
250
|
-
// const shortsStripedLeft = `m 26 101 q 1 2 -1 38`;
|
|
251
|
-
// const shortsStripedRight = `m 77 101 q -1 2 1 38`;
|
|
252
|
-
// page.path(shortsStripedLeft).stroke({ width: 2, color, linecap: "square" });
|
|
253
|
-
// page.path(shortsStripedRight).stroke({ width: 2, color, linecap: "square" });
|
|
254
|
-
// return page;
|
|
255
|
-
// };
|
|
256
249
|
export const drawShortsSideStriped = (page, primaryColor, secondaryColor) => {
|
|
257
250
|
return page.pattern(53, 50, function (add) {
|
|
258
251
|
add.rect(53, 50).fill(primaryColor);
|
|
@@ -260,3 +253,7 @@ export const drawShortsSideStriped = (page, primaryColor, secondaryColor) => {
|
|
|
260
253
|
add.rect(1, 40).radius(1, 1).fill(secondaryColor).move(24.5, 0);
|
|
261
254
|
});
|
|
262
255
|
};
|
|
256
|
+
export function addShoulderStriped(page, color) {
|
|
257
|
+
page.path(`m 17 10, l 18 -9`).stroke({ width: 2, color, linecap: "butt" });
|
|
258
|
+
page.path(`m 83 10, l -18 -9`).stroke({ width: 2, color, linecap: "butt" });
|
|
259
|
+
}
|
|
@@ -20,7 +20,9 @@ export const Default = {
|
|
|
20
20
|
shortsColor: "black",
|
|
21
21
|
image: "https://resources.simcups.com/flags/w80/264.png",
|
|
22
22
|
shortsStyle: "sideStriped",
|
|
23
|
-
|
|
23
|
+
shortsCuffColor: "#6e6dd2",
|
|
24
|
+
shoulderStyle: "striped",
|
|
25
|
+
shoulderStyleColor: "red",
|
|
24
26
|
},
|
|
25
27
|
};
|
|
26
28
|
export const ARS = {
|
package/lib/types/index.d.ts
CHANGED
|
@@ -26,9 +26,12 @@ export interface DrawSoccerJerseyProps {
|
|
|
26
26
|
shortsStyle: ShortsStyle;
|
|
27
27
|
shortsStyleColor?: string;
|
|
28
28
|
shortsCuffColor?: string;
|
|
29
|
+
shoulderStyle: ShoulderStyle;
|
|
30
|
+
shoulderStyleColor?: string;
|
|
29
31
|
withBadge?: boolean;
|
|
30
32
|
withShorts?: boolean;
|
|
31
33
|
}
|
|
32
34
|
export type ShirtStyleDirection = "diagonalRight" | "diagonalLeft" | "horizontal" | "vertical";
|
|
33
35
|
export type ShirtStyle = "plain" | "twoColors" | "striped" | "stripedThin" | "stripedThick" | "sideStriped" | "waves" | "checkered" | "hoops" | "singleBand" | "dashed";
|
|
36
|
+
export type ShoulderStyle = "plain" | "striped";
|
|
34
37
|
export type ShortsStyle = "plain" | "sideStriped";
|
|
@@ -26,4 +26,4 @@ import { DrawSoccerJerseyProps } from "../types";
|
|
|
26
26
|
* @return {string} A data URL ready for direct use as src attribute
|
|
27
27
|
* on <img />
|
|
28
28
|
*/
|
|
29
|
-
export default function drawSoccerJersey({ shirtText, textColor, textOutlineColor, textBackgroundColor, shirtColor, sleeveColor, shirtStyle, shirtStyleColor, shirtStyleDirection, isBack, shirtWidth, collarColor, sleeveCuffColor, shortsColor, shortsCuffColor, shortsStyle, shortsStyleColor, image, imageHeight, imageWidth, imageX, imageY, withBadge, withShorts, }: DrawSoccerJerseyProps): string;
|
|
29
|
+
export default function drawSoccerJersey({ shirtText, textColor, textOutlineColor, textBackgroundColor, shirtColor, sleeveColor, shirtStyle, shirtStyleColor, shirtStyleDirection, isBack, shirtWidth, collarColor, shoulderStyleColor, shoulderStyle, sleeveCuffColor, shortsColor, shortsCuffColor, shortsStyle, shortsStyleColor, image, imageHeight, imageWidth, imageX, imageY, withBadge, withShorts, }: 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 { drawHoops, drawSingleBand, drawStriped, drawCheckered, drawTwoColors, drawWaves, drawDashes, drawShortsSideStriped, drawShirtSideStriped, } from "../patterns/patterns";
|
|
10
|
+
import { drawHoops, drawSingleBand, drawStriped, drawCheckered, drawTwoColors, drawWaves, drawDashes, drawShortsSideStriped, drawShirtSideStriped, addShoulderStriped, } from "../patterns/patterns";
|
|
11
11
|
/**
|
|
12
12
|
* @param {object} specs Specifications of the soccer jersey.
|
|
13
13
|
* @param {string} specs.shirtText The text to be displayed on the shirt.
|
|
@@ -35,7 +35,7 @@ import { drawHoops, drawSingleBand, drawStriped, drawCheckered, drawTwoColors, d
|
|
|
35
35
|
* @return {string} A data URL ready for direct use as src attribute
|
|
36
36
|
* on <img />
|
|
37
37
|
*/
|
|
38
|
-
export default function drawSoccerJersey({ shirtText, textColor, textOutlineColor, textBackgroundColor, shirtColor = "plain", sleeveColor, shirtStyle, shirtStyleColor, shirtStyleDirection, isBack = false, shirtWidth = 200, collarColor, sleeveCuffColor, shortsColor, shortsCuffColor, shortsStyle, shortsStyleColor, image, imageHeight, imageWidth, imageX, imageY, withBadge, withShorts = true, }) {
|
|
38
|
+
export default function drawSoccerJersey({ shirtText, textColor, textOutlineColor, textBackgroundColor, shirtColor = "plain", sleeveColor, shirtStyle, shirtStyleColor, shirtStyleDirection, isBack = false, shirtWidth = 200, collarColor, shoulderStyleColor, shoulderStyle, sleeveCuffColor, shortsColor, shortsCuffColor, shortsStyle, shortsStyleColor, image, imageHeight, imageWidth, imageX, imageY, withBadge, withShorts = true, }) {
|
|
39
39
|
// Colors and Color Optimizations
|
|
40
40
|
const optimizedSleeveColor = lightenDarkenColor(sleeveColor, -10);
|
|
41
41
|
const optimizedShirtColor = lightenDarkenColor(shirtColor, -10);
|
|
@@ -180,6 +180,13 @@ export default function drawSoccerJersey({ shirtText, textColor, textOutlineColo
|
|
|
180
180
|
}
|
|
181
181
|
drawText(page);
|
|
182
182
|
}
|
|
183
|
+
if (shoulderStyle) {
|
|
184
|
+
switch (shortsStyle) {
|
|
185
|
+
case "sideStriped": {
|
|
186
|
+
addShoulderStriped(page, shoulderStyleColor || "red");
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
183
190
|
const shortsHeight = withShorts ? 40 : 0;
|
|
184
191
|
if (withShorts) {
|
|
185
192
|
const pathShorts = `m 23 98 c 5 6, 50 6, 56 0 l 2 ${shortsHeight} c 0 5, -27 5, -27.5 0 l -2 -10, -2 10, c 0 5, -27 5, -27.5 0 l 1 -${shortsHeight}`;
|