@twin.org/image 0.0.4-next.8 → 0.9.0

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.
package/dist/es/color.js CHANGED
@@ -32,6 +32,8 @@ export class Color {
32
32
  * @param red The red element of the color.
33
33
  * @param green The green element of the color.
34
34
  * @param blue The blue element of the color.
35
+ * @throws GuardError if the parameters are invalid.
36
+ * @throws GeneralError If the values are out of range.
35
37
  */
36
38
  constructor(alpha, red, green, blue) {
37
39
  Guards.number(Color.CLASS_NAME, "alpha", alpha);
@@ -1 +1 @@
1
- {"version":3,"file":"color.js","sourceRoot":"","sources":["../../src/color.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,+BAA+B;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAG1D;;GAEG;AACH,MAAM,OAAO,KAAK;IACjB;;OAEG;IACI,MAAM,CAAU,UAAU,WAA2B;IAE5D;;OAEG;IACc,MAAM,CAAS;IAEhC;;OAEG;IACc,IAAI,CAAS;IAE9B;;OAEG;IACc,MAAM,CAAS;IAEhC;;OAEG;IACc,KAAK,CAAS;IAE/B;;;;;;OAMG;IACH,YAAY,KAAa,EAAE,GAAW,EAAE,KAAa,EAAE,IAAY;QAClE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QACtD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,SAAe,GAAG,CAAC,CAAC;QAClD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QACtD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,UAAgB,IAAI,CAAC,CAAC;QAEpD,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC;YAC9B,MAAM,IAAI,YAAY,CAAC,KAAK,CAAC,UAA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* eslint-disable no-bitwise */\n\nimport { GeneralError, Guards, Is } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * Class to represent a color.\n */\nexport class Color {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<Color>();\n\n\t/**\n\t * @internal\n\t */\n\tprivate readonly _alpha: number;\n\n\t/**\n\t * @internal\n\t */\n\tprivate readonly _red: number;\n\n\t/**\n\t * @internal\n\t */\n\tprivate readonly _green: number;\n\n\t/**\n\t * @internal\n\t */\n\tprivate readonly _blue: number;\n\n\t/**\n\t * Create a new instance of color.\n\t * @param alpha The alpha element of the color.\n\t * @param red The red element of the color.\n\t * @param green The green element of the color.\n\t * @param blue The blue element of the color.\n\t */\n\tconstructor(alpha: number, red: number, green: number, blue: number) {\n\t\tGuards.number(Color.CLASS_NAME, nameof(alpha), alpha);\n\t\tGuards.number(Color.CLASS_NAME, nameof(red), red);\n\t\tGuards.number(Color.CLASS_NAME, nameof(green), green);\n\t\tGuards.number(Color.CLASS_NAME, nameof(blue), blue);\n\n\t\tif (alpha < 0 || alpha > 255) {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"range\", {\n\t\t\t\tprop: nameof(alpha),\n\t\t\t\tvalue: alpha\n\t\t\t});\n\t\t}\n\t\tif (red < 0 || red > 255) {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"range\", {\n\t\t\t\tprop: nameof(red),\n\t\t\t\tvalue: red\n\t\t\t});\n\t\t}\n\t\tif (green < 0 || green > 255) {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"range\", {\n\t\t\t\tprop: nameof(green),\n\t\t\t\tvalue: green\n\t\t\t});\n\t\t}\n\t\tif (blue < 0 || blue > 255) {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"range\", {\n\t\t\t\tprop: nameof(blue),\n\t\t\t\tvalue: blue\n\t\t\t});\n\t\t}\n\n\t\tthis._alpha = alpha;\n\t\tthis._red = red;\n\t\tthis._green = green;\n\t\tthis._blue = blue;\n\t}\n\n\t/**\n\t * Construct a color from a hex string.\n\t * @param hex The hex string to parse.\n\t * @returns The color.\n\t * @throws Error if the format is incorrect.\n\t */\n\tpublic static fromHex(hex: string): Color {\n\t\tGuards.stringValue(Color.CLASS_NAME, nameof(hex), hex);\n\n\t\tlet alpha;\n\t\tlet red;\n\t\tlet green;\n\t\tlet blue;\n\t\tif (/^#[\\dA-Fa-f]{3}$/.test(hex)) {\n\t\t\t// #RGB\n\t\t\talpha = \"0xFF\";\n\t\t\tred = hex.slice(1, 2).repeat(2);\n\t\t\tgreen = hex.slice(2, 3).repeat(2);\n\t\t\tblue = hex.slice(3, 4).repeat(2);\n\t\t} else if (/^#[\\dA-Fa-f]{4}$/.test(hex)) {\n\t\t\t// #ARGB\n\t\t\talpha = hex.slice(1, 2).repeat(2);\n\t\t\tred = hex.slice(2, 3).repeat(2);\n\t\t\tgreen = hex.slice(3, 4).repeat(2);\n\t\t\tblue = hex.slice(4, 5).repeat(2);\n\t\t} else if (/^#[\\dA-Fa-f]{6}$/.test(hex)) {\n\t\t\t// #RRGGBB\n\t\t\talpha = \"0xFF\";\n\t\t\tred = hex.slice(1, 3);\n\t\t\tgreen = hex.slice(3, 5);\n\t\t\tblue = hex.slice(5, 7);\n\t\t} else if (/^#[\\dA-Fa-f]{8}$/.test(hex)) {\n\t\t\t// #AARRGGBB\n\t\t\talpha = hex.slice(1, 3);\n\t\t\tred = hex.slice(3, 5);\n\t\t\tgreen = hex.slice(5, 7);\n\t\t\tblue = hex.slice(7, 9);\n\t\t} else {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"hex\", { hex });\n\t\t}\n\t\treturn new Color(\n\t\t\tNumber.parseInt(alpha, 16),\n\t\t\tNumber.parseInt(red, 16),\n\t\t\tNumber.parseInt(green, 16),\n\t\t\tNumber.parseInt(blue, 16)\n\t\t);\n\t}\n\n\t/**\n\t * Coerce an unknown type to a color.\n\t * @param value The value to try and convert.\n\t * @returns The color if one can be created.\n\t */\n\tpublic static coerce(value: unknown): Color | undefined {\n\t\tif (\n\t\t\tIs.object<Color>(value) &&\n\t\t\tIs.number(value._alpha) &&\n\t\t\tIs.number(value._red) &&\n\t\t\tIs.number(value._green) &&\n\t\t\tIs.number(value._blue)\n\t\t) {\n\t\t\treturn new Color(value._alpha, value._red, value._green, value._blue);\n\t\t} else if (Is.stringValue(value) && value.startsWith(\"#\")) {\n\t\t\ttry {\n\t\t\t\treturn Color.fromHex(value);\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\t/**\n\t * Get the alpha element.\n\t * @returns The alpha element.\n\t */\n\tpublic alpha(): number {\n\t\treturn this._alpha;\n\t}\n\n\t/**\n\t * Get the red element.\n\t * @returns The red element.\n\t */\n\tpublic red(): number {\n\t\treturn this._red;\n\t}\n\n\t/**\n\t * Get the green element.\n\t * @returns The green element.\n\t */\n\tpublic green(): number {\n\t\treturn this._green;\n\t}\n\n\t/**\n\t * Get the blue element.\n\t * @returns The blue element.\n\t */\n\tpublic blue(): number {\n\t\treturn this._blue;\n\t}\n\n\t/**\n\t * Get color as argb.\n\t * @returns The color as argb.\n\t */\n\tpublic argb(): number {\n\t\treturn ((this._alpha << 24) | (this._red << 16) | (this._green << 8) | this._blue) >>> 0;\n\t}\n\n\t/**\n\t * Get color as rgba.\n\t * @returns The color as rgba.\n\t */\n\tpublic rgba(): number {\n\t\treturn ((this._red << 24) | (this._green << 16) | (this._blue << 8) | this._alpha) >>> 0;\n\t}\n\n\t/**\n\t * Get color as rgb text.\n\t * @returns The color as rgb.\n\t */\n\tpublic rgbText(): string {\n\t\treturn `rgb(${this._red},${this._green},${this._blue})`;\n\t}\n\n\t/**\n\t * Get color as rgba text.\n\t * @returns The color as rgba.\n\t */\n\tpublic rgbaText(): string {\n\t\treturn `rgba(${this._red},${this._green},${this._blue},${Math.round((this._alpha / 255) * 100) / 100})`;\n\t}\n\n\t/**\n\t * Get color as hex no alpha.\n\t * @returns The color as hex with no alpha component.\n\t */\n\tpublic hex(): string {\n\t\tconst red = `00${this._red.toString(16)}`.slice(-2);\n\t\tconst green = `00${this._green.toString(16)}`.slice(-2);\n\t\tconst blue = `00${this._blue.toString(16)}`.slice(-2);\n\t\treturn `#${red}${green}${blue}`.toUpperCase();\n\t}\n\n\t/**\n\t * Get color as hex with alpha.\n\t * @returns The color as hex with with alpha component.\n\t */\n\tpublic hexWithAlpha(): string {\n\t\tconst alpha = `00${this._alpha.toString(16)}`.slice(-2);\n\t\tconst red = `00${this._red.toString(16)}`.slice(-2);\n\t\tconst green = `00${this._green.toString(16)}`.slice(-2);\n\t\tconst blue = `00${this._blue.toString(16)}`.slice(-2);\n\t\treturn `#${alpha}${red}${green}${blue}`.toUpperCase();\n\t}\n}\n"]}
1
+ {"version":3,"file":"color.js","sourceRoot":"","sources":["../../src/color.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,+BAA+B;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAG1D;;GAEG;AACH,MAAM,OAAO,KAAK;IACjB;;OAEG;IACI,MAAM,CAAU,UAAU,WAA2B;IAE5D;;OAEG;IACc,MAAM,CAAS;IAEhC;;OAEG;IACc,IAAI,CAAS;IAE9B;;OAEG;IACc,MAAM,CAAS;IAEhC;;OAEG;IACc,KAAK,CAAS;IAE/B;;;;;;;;OAQG;IACH,YAAY,KAAa,EAAE,GAAW,EAAE,KAAa,EAAE,IAAY;QAClE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QACtD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,SAAe,GAAG,CAAC,CAAC;QAClD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QACtD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,UAAgB,IAAI,CAAC,CAAC;Q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,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACvD,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n/* eslint-disable no-bitwise */\n\nimport { GeneralError, Guards, Is } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * Class to represent a color.\n */\nexport class Color {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<Color>();\n\n\t/**\n\t * @internal\n\t */\n\tprivate readonly _alpha: number;\n\n\t/**\n\t * @internal\n\t */\n\tprivate readonly _red: number;\n\n\t/**\n\t * @internal\n\t */\n\tprivate readonly _green: number;\n\n\t/**\n\t * @internal\n\t */\n\tprivate readonly _blue: number;\n\n\t/**\n\t * Create a new instance of color.\n\t * @param alpha The alpha element of the color.\n\t * @param red The red element of the color.\n\t * @param green The green element of the color.\n\t * @param blue The blue element of the color.\n\t * @throws GuardError if the parameters are invalid.\n\t * @throws GeneralError If the values are out of range.\n\t */\n\tconstructor(alpha: number, red: number, green: number, blue: number) {\n\t\tGuards.number(Color.CLASS_NAME, nameof(alpha), alpha);\n\t\tGuards.number(Color.CLASS_NAME, nameof(red), red);\n\t\tGuards.number(Color.CLASS_NAME, nameof(green), green);\n\t\tGuards.number(Color.CLASS_NAME, nameof(blue), blue);\n\n\t\tif (alpha < 0 || alpha > 255) {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"range\", {\n\t\t\t\tprop: nameof(alpha),\n\t\t\t\tvalue: alpha\n\t\t\t});\n\t\t}\n\t\tif (red < 0 || red > 255) {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"range\", {\n\t\t\t\tprop: nameof(red),\n\t\t\t\tvalue: red\n\t\t\t});\n\t\t}\n\t\tif (green < 0 || green > 255) {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"range\", {\n\t\t\t\tprop: nameof(green),\n\t\t\t\tvalue: green\n\t\t\t});\n\t\t}\n\t\tif (blue < 0 || blue > 255) {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"range\", {\n\t\t\t\tprop: nameof(blue),\n\t\t\t\tvalue: blue\n\t\t\t});\n\t\t}\n\n\t\tthis._alpha = alpha;\n\t\tthis._red = red;\n\t\tthis._green = green;\n\t\tthis._blue = blue;\n\t}\n\n\t/**\n\t * Construct a color from a hex string.\n\t * @param hex The hex string to parse.\n\t * @returns The color.\n\t * @throws Error if the format is incorrect.\n\t */\n\tpublic static fromHex(hex: string): Color {\n\t\tGuards.stringValue(Color.CLASS_NAME, nameof(hex), hex);\n\n\t\tlet alpha;\n\t\tlet red;\n\t\tlet green;\n\t\tlet blue;\n\t\tif (/^#[\\dA-Fa-f]{3}$/.test(hex)) {\n\t\t\t// #RGB\n\t\t\talpha = \"0xFF\";\n\t\t\tred = hex.slice(1, 2).repeat(2);\n\t\t\tgreen = hex.slice(2, 3).repeat(2);\n\t\t\tblue = hex.slice(3, 4).repeat(2);\n\t\t} else if (/^#[\\dA-Fa-f]{4}$/.test(hex)) {\n\t\t\t// #ARGB\n\t\t\talpha = hex.slice(1, 2).repeat(2);\n\t\t\tred = hex.slice(2, 3).repeat(2);\n\t\t\tgreen = hex.slice(3, 4).repeat(2);\n\t\t\tblue = hex.slice(4, 5).repeat(2);\n\t\t} else if (/^#[\\dA-Fa-f]{6}$/.test(hex)) {\n\t\t\t// #RRGGBB\n\t\t\talpha = \"0xFF\";\n\t\t\tred = hex.slice(1, 3);\n\t\t\tgreen = hex.slice(3, 5);\n\t\t\tblue = hex.slice(5, 7);\n\t\t} else if (/^#[\\dA-Fa-f]{8}$/.test(hex)) {\n\t\t\t// #AARRGGBB\n\t\t\talpha = hex.slice(1, 3);\n\t\t\tred = hex.slice(3, 5);\n\t\t\tgreen = hex.slice(5, 7);\n\t\t\tblue = hex.slice(7, 9);\n\t\t} else {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"hex\", { hex });\n\t\t}\n\t\treturn new Color(\n\t\t\tNumber.parseInt(alpha, 16),\n\t\t\tNumber.parseInt(red, 16),\n\t\t\tNumber.parseInt(green, 16),\n\t\t\tNumber.parseInt(blue, 16)\n\t\t);\n\t}\n\n\t/**\n\t * Coerce an unknown type to a color.\n\t * @param value The value to try and convert.\n\t * @returns The color if one can be created.\n\t */\n\tpublic static coerce(value: unknown): Color | undefined {\n\t\tif (\n\t\t\tIs.object<Color>(value) &&\n\t\t\tIs.number(value._alpha) &&\n\t\t\tIs.number(value._red) &&\n\t\t\tIs.number(value._green) &&\n\t\t\tIs.number(value._blue)\n\t\t) {\n\t\t\treturn new Color(value._alpha, value._red, value._green, value._blue);\n\t\t} else if (Is.stringValue(value) && value.startsWith(\"#\")) {\n\t\t\ttry {\n\t\t\t\treturn Color.fromHex(value);\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\t/**\n\t * Get the alpha element.\n\t * @returns The alpha element.\n\t */\n\tpublic alpha(): number {\n\t\treturn this._alpha;\n\t}\n\n\t/**\n\t * Get the red element.\n\t * @returns The red element.\n\t */\n\tpublic red(): number {\n\t\treturn this._red;\n\t}\n\n\t/**\n\t * Get the green element.\n\t * @returns The green element.\n\t */\n\tpublic green(): number {\n\t\treturn this._green;\n\t}\n\n\t/**\n\t * Get the blue element.\n\t * @returns The blue element.\n\t */\n\tpublic blue(): number {\n\t\treturn this._blue;\n\t}\n\n\t/**\n\t * Get color as argb.\n\t * @returns The color as argb.\n\t */\n\tpublic argb(): number {\n\t\treturn ((this._alpha << 24) | (this._red << 16) | (this._green << 8) | this._blue) >>> 0;\n\t}\n\n\t/**\n\t * Get color as rgba.\n\t * @returns The color as rgba.\n\t */\n\tpublic rgba(): number {\n\t\treturn ((this._red << 24) | (this._green << 16) | (this._blue << 8) | this._alpha) >>> 0;\n\t}\n\n\t/**\n\t * Get color as rgb text.\n\t * @returns The color as rgb.\n\t */\n\tpublic rgbText(): string {\n\t\treturn `rgb(${this._red},${this._green},${this._blue})`;\n\t}\n\n\t/**\n\t * Get color as rgba text.\n\t * @returns The color as rgba.\n\t */\n\tpublic rgbaText(): string {\n\t\treturn `rgba(${this._red},${this._green},${this._blue},${Math.round((this._alpha / 255) * 100) / 100})`;\n\t}\n\n\t/**\n\t * Get color as hex no alpha.\n\t * @returns The color as hex with no alpha component.\n\t */\n\tpublic hex(): string {\n\t\tconst red = `00${this._red.toString(16)}`.slice(-2);\n\t\tconst green = `00${this._green.toString(16)}`.slice(-2);\n\t\tconst blue = `00${this._blue.toString(16)}`.slice(-2);\n\t\treturn `#${red}${green}${blue}`.toUpperCase();\n\t}\n\n\t/**\n\t * Get color as hex with alpha.\n\t * @returns The color as hex with with alpha component.\n\t */\n\tpublic hexWithAlpha(): string {\n\t\tconst alpha = `00${this._alpha.toString(16)}`.slice(-2);\n\t\tconst red = `00${this._red.toString(16)}`.slice(-2);\n\t\tconst green = `00${this._green.toString(16)}`.slice(-2);\n\t\tconst blue = `00${this._blue.toString(16)}`.slice(-2);\n\t\treturn `#${alpha}${red}${green}${blue}`.toUpperCase();\n\t}\n}\n"]}
@@ -12,6 +12,8 @@ export declare class Color {
12
12
  * @param red The red element of the color.
13
13
  * @param green The green element of the color.
14
14
  * @param blue The blue element of the color.
15
+ * @throws GuardError if the parameters are invalid.
16
+ * @throws GeneralError If the values are out of range.
15
17
  */
16
18
  constructor(alpha: number, red: number, green: number, blue: number);
17
19
  /**
package/docs/changelog.md CHANGED
@@ -1,5 +1,202 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.9.0](https://github.com/iotaledger/twin-framework/compare/image-v0.9.0...image-v0.9.0) (2026-06-22)
4
+
5
+
6
+ ### Features
7
+
8
+ * release to production ([b24cba1](https://github.com/iotaledger/twin-framework/commit/b24cba1b6a969278d638e632590602ec881e49fb))
9
+ * release to production ([787287d](https://github.com/iotaledger/twin-framework/commit/787287d06ea8319657401589d61fff369310c422))
10
+ * release to production ([53f4843](https://github.com/iotaledger/twin-framework/commit/53f484326b2851d7a506d2620db24c4a65cee7b3))
11
+ * release to production ([56cda4d](https://github.com/iotaledger/twin-framework/commit/56cda4da93e978c5be19ec7cfd421ae2a7fe4147))
12
+ * release to production ([f7c6586](https://github.com/iotaledger/twin-framework/commit/f7c6586f6976b903b647b4c5ac5ad9421e0c9051))
13
+ * release to production ([829d53d](https://github.com/iotaledger/twin-framework/commit/829d53d3953b1e1b40b0243c04cfdfd3842aac7b))
14
+ * release to production ([5cf3a76](https://github.com/iotaledger/twin-framework/commit/5cf3a76a09eff2e6414d0cba846c7c37400a11d6))
15
+ * release to production ([#330](https://github.com/iotaledger/twin-framework/issues/330)) ([d73f565](https://github.com/iotaledger/twin-framework/commit/d73f565588d156d23ef49b2a5718973756f7a696))
16
+ * release to production ([#382](https://github.com/iotaledger/twin-framework/issues/382)) ([bbed01a](https://github.com/iotaledger/twin-framework/commit/bbed01a605ee9724bda77a0f7feab249118c2d90))
17
+
18
+
19
+ ### Miscellaneous Chores
20
+
21
+ * release to production ([63cae24](https://github.com/iotaledger/twin-framework/commit/63cae2401f6c11f93b2a01260b665064e8bd28e0))
22
+
23
+ ## [0.9.0-next.1](https://github.com/iotaledger/twin-framework/compare/image-v0.9.0-next.0...image-v0.9.0-next.1) (2026-06-22)
24
+
25
+
26
+ ### Features
27
+
28
+ * add context id features ([#206](https://github.com/iotaledger/twin-framework/issues/206)) ([ef0d4ee](https://github.com/iotaledger/twin-framework/commit/ef0d4ee11a4f5fc6cc6f52a4958ce905c04ee13b))
29
+ * eslint migration to flat config ([74427d7](https://github.com/iotaledger/twin-framework/commit/74427d78d342167f7850e49ab87269326355befe))
30
+ * locales validation ([#197](https://github.com/iotaledger/twin-framework/issues/197)) ([55fdadb](https://github.com/iotaledger/twin-framework/commit/55fdadb13595ce0047f787bd1d4135d429a99f12))
31
+ * relocate core packages from tools ([bcab8f3](https://github.com/iotaledger/twin-framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
32
+ * typescript 6 update ([1d10f31](https://github.com/iotaledger/twin-framework/commit/1d10f31e6516ec622773f45e88af82fe749b384a))
33
+ * update dependencies ([4da77ab](https://github.com/iotaledger/twin-framework/commit/4da77ab30f499e52825ac5a76f51436ceb59c26e))
34
+ * update dependencies ([f3bd015](https://github.com/iotaledger/twin-framework/commit/f3bd015efd169196b7e0335f5cab876ba6ca1d75))
35
+ * use cause instead of inner for errors ([1f4acc4](https://github.com/iotaledger/twin-framework/commit/1f4acc4d7a6b71a134d9547da9bf40de1e1e49da))
36
+
37
+
38
+ ### Bug Fixes
39
+
40
+ * ensure __decorate is defined for decorators ([103a563](https://github.com/iotaledger/twin-framework/commit/103a563ce01ebdef6240d2e590e7b026e8692684))
41
+
42
+
43
+ ### Dependencies
44
+
45
+ * The following workspace dependencies were updated
46
+ * dependencies
47
+ * @twin.org/core bumped from 0.9.0-next.0 to 0.9.0-next.1
48
+ * @twin.org/nameof bumped from 0.9.0-next.0 to 0.9.0-next.1
49
+ * devDependencies
50
+ * @twin.org/nameof-transformer bumped from 0.9.0-next.0 to 0.9.0-next.1
51
+ * @twin.org/nameof-vitest-plugin bumped from 0.9.0-next.0 to 0.9.0-next.1
52
+ * @twin.org/validate-locales bumped from 0.9.0-next.0 to 0.9.0-next.1
53
+
54
+ ## [0.0.4-next.15](https://github.com/iotaledger/twin-framework/compare/image-v0.0.4-next.14...image-v0.0.4-next.15) (2026-06-19)
55
+
56
+
57
+ ### Miscellaneous Chores
58
+
59
+ * **image:** Synchronize repo versions
60
+
61
+
62
+ ### Dependencies
63
+
64
+ * The following workspace dependencies were updated
65
+ * dependencies
66
+ * @twin.org/core bumped from 0.0.4-next.14 to 0.0.4-next.15
67
+ * @twin.org/nameof bumped from 0.0.4-next.14 to 0.0.4-next.15
68
+ * devDependencies
69
+ * @twin.org/nameof-transformer bumped from 0.0.4-next.14 to 0.0.4-next.15
70
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.4-next.14 to 0.0.4-next.15
71
+ * @twin.org/validate-locales bumped from 0.0.4-next.14 to 0.0.4-next.15
72
+
73
+ ## [0.0.4-next.14](https://github.com/iotaledger/twin-framework/compare/image-v0.0.4-next.13...image-v0.0.4-next.14) (2026-06-18)
74
+
75
+
76
+ ### Miscellaneous Chores
77
+
78
+ * **image:** Synchronize repo versions
79
+
80
+
81
+ ### Dependencies
82
+
83
+ * The following workspace dependencies were updated
84
+ * dependencies
85
+ * @twin.org/core bumped from 0.0.4-next.13 to 0.0.4-next.14
86
+ * @twin.org/nameof bumped from 0.0.4-next.13 to 0.0.4-next.14
87
+ * devDependencies
88
+ * @twin.org/nameof-transformer bumped from 0.0.4-next.13 to 0.0.4-next.14
89
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.4-next.13 to 0.0.4-next.14
90
+ * @twin.org/validate-locales bumped from 0.0.4-next.13 to 0.0.4-next.14
91
+
92
+ ## [0.0.4-next.13](https://github.com/iotaledger/twin-framework/compare/image-v0.0.4-next.12...image-v0.0.4-next.13) (2026-06-18)
93
+
94
+
95
+ ### Miscellaneous Chores
96
+
97
+ * **image:** Synchronize repo versions
98
+
99
+
100
+ ### Dependencies
101
+
102
+ * The following workspace dependencies were updated
103
+ * dependencies
104
+ * @twin.org/core bumped from 0.0.4-next.12 to 0.0.4-next.13
105
+ * @twin.org/nameof bumped from 0.0.4-next.12 to 0.0.4-next.13
106
+ * devDependencies
107
+ * @twin.org/nameof-transformer bumped from 0.0.4-next.12 to 0.0.4-next.13
108
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.4-next.12 to 0.0.4-next.13
109
+ * @twin.org/validate-locales bumped from 0.0.4-next.12 to 0.0.4-next.13
110
+
111
+ ## [0.0.4-next.12](https://github.com/iotaledger/twin-framework/compare/image-v0.0.4-next.11...image-v0.0.4-next.12) (2026-06-18)
112
+
113
+
114
+ ### Miscellaneous Chores
115
+
116
+ * **image:** Synchronize repo versions
117
+
118
+
119
+ ### Dependencies
120
+
121
+ * The following workspace dependencies were updated
122
+ * dependencies
123
+ * @twin.org/core bumped from 0.0.4-next.11 to 0.0.4-next.12
124
+ * @twin.org/nameof bumped from 0.0.4-next.11 to 0.0.4-next.12
125
+ * devDependencies
126
+ * @twin.org/nameof-transformer bumped from 0.0.4-next.11 to 0.0.4-next.12
127
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.4-next.11 to 0.0.4-next.12
128
+ * @twin.org/validate-locales bumped from 0.0.4-next.11 to 0.0.4-next.12
129
+
130
+ ## [0.0.4-next.11](https://github.com/iotaledger/twin-framework/compare/image-v0.0.4-next.10...image-v0.0.4-next.11) (2026-06-15)
131
+
132
+
133
+ ### Miscellaneous Chores
134
+
135
+ * **image:** Synchronize repo versions
136
+
137
+
138
+ ### Dependencies
139
+
140
+ * The following workspace dependencies were updated
141
+ * dependencies
142
+ * @twin.org/core bumped from 0.0.4-next.10 to 0.0.4-next.11
143
+ * @twin.org/nameof bumped from 0.0.4-next.10 to 0.0.4-next.11
144
+ * devDependencies
145
+ * @twin.org/nameof-transformer bumped from 0.0.4-next.10 to 0.0.4-next.11
146
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.4-next.10 to 0.0.4-next.11
147
+ * @twin.org/validate-locales bumped from 0.0.4-next.10 to 0.0.4-next.11
148
+
149
+ ## [0.0.4-next.10](https://github.com/iotaledger/twin-framework/compare/image-v0.0.4-next.9...image-v0.0.4-next.10) (2026-06-15)
150
+
151
+
152
+ ### Features
153
+
154
+ * add context id features ([#206](https://github.com/iotaledger/twin-framework/issues/206)) ([ef0d4ee](https://github.com/iotaledger/twin-framework/commit/ef0d4ee11a4f5fc6cc6f52a4958ce905c04ee13b))
155
+ * add guards arrayEndsWith and arrayStartsWith ([95d875e](https://github.com/iotaledger/twin-framework/commit/95d875ec8ccb4713c145fdde941d4cfedcec2ed3))
156
+ * eslint migration to flat config ([74427d7](https://github.com/iotaledger/twin-framework/commit/74427d78d342167f7850e49ab87269326355befe))
157
+ * locales validation ([#197](https://github.com/iotaledger/twin-framework/issues/197)) ([55fdadb](https://github.com/iotaledger/twin-framework/commit/55fdadb13595ce0047f787bd1d4135d429a99f12))
158
+ * relocate core packages from tools ([bcab8f3](https://github.com/iotaledger/twin-framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
159
+ * typescript 6 update ([1d10f31](https://github.com/iotaledger/twin-framework/commit/1d10f31e6516ec622773f45e88af82fe749b384a))
160
+ * update dependencies ([4da77ab](https://github.com/iotaledger/twin-framework/commit/4da77ab30f499e52825ac5a76f51436ceb59c26e))
161
+ * update dependencies ([f3bd015](https://github.com/iotaledger/twin-framework/commit/f3bd015efd169196b7e0335f5cab876ba6ca1d75))
162
+ * use cause instead of inner for errors ([1f4acc4](https://github.com/iotaledger/twin-framework/commit/1f4acc4d7a6b71a134d9547da9bf40de1e1e49da))
163
+
164
+
165
+ ### Bug Fixes
166
+
167
+ * ensure __decorate is defined for decorators ([103a563](https://github.com/iotaledger/twin-framework/commit/103a563ce01ebdef6240d2e590e7b026e8692684))
168
+
169
+
170
+ ### Dependencies
171
+
172
+ * The following workspace dependencies were updated
173
+ * dependencies
174
+ * @twin.org/core bumped from 0.0.4-next.9 to 0.0.4-next.10
175
+ * @twin.org/nameof bumped from 0.0.4-next.9 to 0.0.4-next.10
176
+ * devDependencies
177
+ * @twin.org/nameof-transformer bumped from 0.0.4-next.9 to 0.0.4-next.10
178
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.4-next.9 to 0.0.4-next.10
179
+ * @twin.org/validate-locales bumped from 0.0.4-next.9 to 0.0.4-next.10
180
+
181
+ ## [0.0.4-next.9](https://github.com/iotaledger/twin-framework/compare/image-v0.0.4-next.8...image-v0.0.4-next.9) (2026-06-15)
182
+
183
+
184
+ ### Miscellaneous Chores
185
+
186
+ * **image:** Synchronize repo versions
187
+
188
+
189
+ ### Dependencies
190
+
191
+ * The following workspace dependencies were updated
192
+ * dependencies
193
+ * @twin.org/core bumped from 0.0.4-next.8 to 0.0.4-next.9
194
+ * @twin.org/nameof bumped from 0.0.4-next.8 to 0.0.4-next.9
195
+ * devDependencies
196
+ * @twin.org/nameof-transformer bumped from 0.0.4-next.8 to 0.0.4-next.9
197
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.4-next.8 to 0.0.4-next.9
198
+ * @twin.org/validate-locales bumped from 0.0.4-next.8 to 0.0.4-next.9
199
+
3
200
  ## [0.0.4-next.8](https://github.com/iotaledger/twin-framework/compare/image-v0.0.4-next.7...image-v0.0.4-next.8) (2026-06-10)
4
201
 
5
202
 
@@ -40,6 +40,14 @@ The blue element of the color.
40
40
 
41
41
  `Color`
42
42
 
43
+ #### Throws
44
+
45
+ GuardError if the parameters are invalid.
46
+
47
+ #### Throws
48
+
49
+ GeneralError If the values are out of range.
50
+
43
51
  ## Properties
44
52
 
45
53
  ### CLASS\_NAME {#class_name}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/image",
3
- "version": "0.0.4-next.8",
3
+ "version": "0.9.0",
4
4
  "description": "Classes for image manipulation",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,8 +14,8 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/core": "0.0.4-next.8",
18
- "@twin.org/nameof": "0.0.4-next.8"
17
+ "@twin.org/core": "^0.9.0",
18
+ "@twin.org/nameof": "^0.9.0"
19
19
  },
20
20
  "main": "./dist/es/index.js",
21
21
  "types": "./dist/types/index.d.ts",