chromaticity-color-utilities
Advanced tools
Comparing version 0.4.0-alpha to 0.5.0-alpha
@@ -9,2 +9,3 @@ import { newColorArgs, colorType } from './ColorType'; | ||
constructor(r: number, g: number, b: number, a?: number, gamma?: number); | ||
toString(): string; | ||
} | ||
@@ -14,2 +15,3 @@ export declare class hex extends colorType { | ||
constructor(hex: string | number); | ||
toString(): string; | ||
protected torgb(args: newColorArgs): rgb; | ||
@@ -26,2 +28,3 @@ protected tohex(args: newColorArgs): hex; | ||
constructor(r: number, g: number, b: number, a?: number, bitDepth?: number); | ||
toString(): string; | ||
protected torgb(args: newColorArgs): rgb; | ||
@@ -37,2 +40,3 @@ } | ||
constructor(r: number, g: number, b: number, a?: number, bitDepth?: number); | ||
toString(): string; | ||
protected torgb(args: newColorArgs): rgb; | ||
@@ -49,2 +53,3 @@ protected torec709(args: newColorArgs): rec709rgb; | ||
constructor(r: number, g: number, b: number, a?: number, bitDepth?: number); | ||
toString(): string; | ||
protected torgb(args: newColorArgs): rgb; | ||
@@ -59,6 +64,6 @@ protected torec2020(args: newColorArgs): rec2020rgb; | ||
constructor(h: number, s: number, v: number, a?: number); | ||
toString(): string; | ||
protected torgb(args: newColorArgs): rgb; | ||
protected tohsv(args: newColorArgs): hsv; | ||
protected tohsl(args: newColorArgs): hsl; | ||
protected tohsi(args: newColorArgs): hsi; | ||
} | ||
@@ -71,6 +76,6 @@ export declare class hsl extends colorType { | ||
constructor(h: number, s: number, l: number, a?: number); | ||
toString(): string; | ||
protected torgb(args: newColorArgs): rgb; | ||
protected tohsv(args: newColorArgs): hsv; | ||
protected tohsl(args: newColorArgs): hsl; | ||
protected tohsi(args: newColorArgs): hsi; | ||
} | ||
@@ -83,5 +88,4 @@ export declare class hsi extends colorType { | ||
constructor(h: number, s: number, i: number, a?: number); | ||
toString(): string; | ||
protected torgb(args: newColorArgs): rgb; | ||
protected tohsv(args: newColorArgs): hsv; | ||
protected tohsl(args: newColorArgs): hsl; | ||
protected tohsi(args: newColorArgs): hsi; | ||
@@ -98,4 +102,5 @@ } | ||
constructor(h: number, s: number, p: number, a?: number, pb?: number, pr?: number); | ||
toString(): string; | ||
protected torgb(args: newColorArgs): rgb; | ||
protected tohsb(args: newColorArgs): hsp; | ||
protected tohsp(args: newColorArgs): hsp; | ||
} | ||
@@ -108,2 +113,3 @@ export declare class cmyk extends colorType { | ||
constructor(c: number, m: number, y: number, k: number); | ||
toString(): string; | ||
protected torgb(args: newColorArgs): rgb; | ||
@@ -126,2 +132,3 @@ protected tocmyk(args: newColorArgs): cmyk; | ||
constructor(y: number, i: number, q: number, normalized?: boolean); | ||
toString(): string; | ||
protected torgb(args: newColorArgs): rgb; | ||
@@ -135,2 +142,3 @@ protected toyiq(args: newColorArgs): yiq; | ||
constructor(x: number, y: number, z: number); | ||
toString(): string; | ||
protected torgb(args: newColorArgs): rgb; | ||
@@ -145,2 +153,3 @@ protected toxyz(args: newColorArgs): xyz; | ||
protected torgb(args: newColorArgs): rgb; | ||
toString(): string; | ||
protected toxyz(args: newColorArgs): xyz; | ||
@@ -160,2 +169,3 @@ protected toxyy(args: newColorArgs): xyy; | ||
constructor(l: number, a: number, b: number); | ||
toString(): string; | ||
protected torgb(args: newColorArgs): rgb; | ||
@@ -176,2 +186,3 @@ protected toxyz(args: newColorArgs): xyz; | ||
constructor(l: number, u: number, v: number); | ||
toString(): string; | ||
protected torgb(args: newColorArgs): rgb; | ||
@@ -188,2 +199,3 @@ protected toxyz(args: newColorArgs): xyz; | ||
constructor(y: number, pb: number, pr: number, kb: number, kr: number); | ||
toString(): string; | ||
protected torgb(args: newColorArgs): rgb; | ||
@@ -202,2 +214,3 @@ protected toypbpr(args: newColorArgs): ypbpr; | ||
constructor(y: number, cb: number, cr: number, yLower?: number, yUpper?: number, cLower?: number, cUpper?: number); | ||
toString(): string; | ||
protected torgb(args: newColorArgs): rgb; | ||
@@ -210,2 +223,3 @@ protected toypbpr(args: newColorArgs): ypbpr; | ||
constructor(wavelength: number); | ||
toString(): string; | ||
protected torgb(args: newColorArgs): rgb; | ||
@@ -216,3 +230,4 @@ } | ||
constructor(k: number); | ||
toString(): string; | ||
protected torgb(args: newColorArgs): rgb; | ||
} |
@@ -58,2 +58,5 @@ "use strict"; | ||
} | ||
rgbNormalized.prototype.toString = function () { | ||
return "rgbNormalized: { r: ".concat(this.r, ", g: ").concat(this.g, ", b: ").concat(this.b, ", a: ").concat(this.a, ", gamma: ").concat(this.gamma, " }"); | ||
}; | ||
return rgbNormalized; | ||
@@ -91,2 +94,5 @@ }(ColorType_1.colorType)); | ||
} | ||
hex.prototype.toString = function () { | ||
return "hex: { hex: ".concat(this.hex, " }"); | ||
}; | ||
hex.prototype.torgb = function (args) { | ||
@@ -122,2 +128,5 @@ return Convert_1.default.hex2rgb(this, args.bitDepth); | ||
} | ||
rgb.prototype.toString = function () { | ||
return "rgb: { r: ".concat(this.r, ", g: ").concat(this.g, ", b: ").concat(this.b, ", a: ").concat(this.a, ", bitDepth: ").concat(this.bitDepth, " }"); | ||
}; | ||
rgb.prototype.torgb = function (args) { | ||
@@ -165,2 +174,5 @@ if (args.round !== false) { | ||
} | ||
rec709rgb.prototype.toString = function () { | ||
return "rec709rgb: { r: ".concat(this.r, ", g: ").concat(this.g, ", b: ").concat(this.b, ", a: ").concat(this.a, ", bitDepth: ").concat(this.bitDepth, " }"); | ||
}; | ||
rec709rgb.prototype.torgb = function (args) { | ||
@@ -211,2 +223,5 @@ return Convert_1.default.rec709rgb2rgb(this, args.round, args.bitDepth); | ||
} | ||
rec2020rgb.prototype.toString = function () { | ||
return "rec2020rgb: { r: ".concat(this.r, ", g: ").concat(this.g, ", b: ").concat(this.b, ", a: ").concat(this.a, ", bitDepth: ").concat(this.bitDepth, " }"); | ||
}; | ||
rec2020rgb.prototype.torgb = function (args) { | ||
@@ -242,2 +257,5 @@ return Convert_1.default.rec2020rgb2rgb(this, args.round, args.bitDepth); | ||
} | ||
hsv.prototype.toString = function () { | ||
return "hsv: { h: ".concat(this.h, ", s: ").concat(this.s, ", v: ").concat(this.v, ", a: ").concat(this.a, " }"); | ||
}; | ||
hsv.prototype.torgb = function (args) { | ||
@@ -258,5 +276,2 @@ return Convert_1.default.hsv2rgb(this, args.round, args.bitDepth); | ||
}; | ||
hsv.prototype.tohsi = function (args) { | ||
return Convert_1.default.hsv2hsi(this, args.round); | ||
}; | ||
return hsv; | ||
@@ -280,2 +295,5 @@ }(ColorType_1.colorType)); | ||
} | ||
hsl.prototype.toString = function () { | ||
return "hsl: { h: ".concat(this.h, ", s: ").concat(this.s, ", l: ").concat(this.l, ", a: ").concat(this.a, " }"); | ||
}; | ||
hsl.prototype.torgb = function (args) { | ||
@@ -296,5 +314,2 @@ return Convert_1.default.hsl2rgb(this, args.round, args.bitDepth); | ||
}; | ||
hsl.prototype.tohsi = function (args) { | ||
return Convert_1.default.hsl2hsi(this, args.round); | ||
}; | ||
return hsl; | ||
@@ -318,11 +333,14 @@ }(ColorType_1.colorType)); | ||
} | ||
hsi.prototype.toString = function () { | ||
return "hsi: { h: ".concat(this.h, ", s: ").concat(this.s, ", i: ").concat(this.i, ", a: ").concat(this.a, " }"); | ||
}; | ||
hsi.prototype.torgb = function (args) { | ||
return Convert_1.default.hsi2rgb(this, args.round, args.bitDepth); | ||
}; | ||
hsi.prototype.tohsv = function (args) { | ||
return Convert_1.default.hsi2hsv(this, args.round); | ||
}; | ||
hsi.prototype.tohsl = function (args) { | ||
return Convert_1.default.hsi2hsl(this, args.round); | ||
}; | ||
// protected tohsv(args: newColorArgs): hsv { | ||
// return Convert.hsi2hsv(this, args.round) | ||
// } | ||
// protected tohsl(args: newColorArgs): hsl { | ||
// return Convert.hsi2hsl(this, args.round) | ||
// } | ||
hsi.prototype.tohsi = function (args) { | ||
@@ -363,6 +381,9 @@ if (args.round !== false) { | ||
} | ||
hsp.prototype.toString = function () { | ||
return "hsp: { h: ".concat(this.h, ", s: ").concat(this.s, ", p: ").concat(this.p, ", a: ").concat(this.a, ", pr: ").concat(this.pr, ", pg: ").concat(this.pg, ", pb: ").concat(this.pb, " }"); | ||
}; | ||
hsp.prototype.torgb = function (args) { | ||
return Convert_1.default.hsp2rgb(this, args.round, args.bitDepth); | ||
}; | ||
hsp.prototype.tohsb = function (args) { | ||
hsp.prototype.tohsp = function (args) { | ||
if (args.round !== false) { | ||
@@ -393,2 +414,5 @@ this.h = Math.round(this.h); | ||
} | ||
cmyk.prototype.toString = function () { | ||
return "cmyk: { c: ".concat(this.c, ", m: ").concat(this.m, ", y: ").concat(this.y, ", k: ").concat(this.k, " }"); | ||
}; | ||
cmyk.prototype.torgb = function (args) { | ||
@@ -438,2 +462,5 @@ return Convert_1.default.cmyk2rgb(this, args.round, args.bitDepth); | ||
} | ||
yiq.prototype.toString = function () { | ||
return "yiq: { y: ".concat(this.y, ", i: ").concat(this.i, ", q: ").concat(this.q, ", normalized: ").concat(this.normalized, " }"); | ||
}; | ||
yiq.prototype.torgb = function (args) { | ||
@@ -465,2 +492,5 @@ return Convert_1.default.yiq2rgb(this, args.round, args.bitDepth); | ||
} | ||
xyz.prototype.toString = function () { | ||
return "xyz: { x: ".concat(this.x, ", y: ").concat(this.y, ", z: ").concat(this.z, " }"); | ||
}; | ||
xyz.prototype.torgb = function (args) { | ||
@@ -487,2 +517,5 @@ return Convert_1.default.xyz2rgb(this, args.colorSpace, args.referenceWhite, args.round, args.bitDepth); | ||
}; | ||
xyy.prototype.toString = function () { | ||
return "xyy: { x: ".concat(this.x, ", y: ").concat(this.y, ", yy: ").concat(this.yy, " }"); | ||
}; | ||
xyy.prototype.toxyz = function (args) { | ||
@@ -517,2 +550,5 @@ return Convert_1.default.xyy2xyz(this); | ||
} | ||
lab.prototype.toString = function () { | ||
return "lab: { l: ".concat(this.l, ", a: ").concat(this.a, ", b: ").concat(this.b, " }"); | ||
}; | ||
lab.prototype.torgb = function (args) { | ||
@@ -557,2 +593,5 @@ return Convert_1.default.xyz2rgb(this.toxyz(args), args.colorSpace, args.referenceWhite, args.round, args.bitDepth); | ||
} | ||
luv.prototype.toString = function () { | ||
return "luv: { l: ".concat(this.l, ", u: ").concat(this.u, ", v: ").concat(this.v, " }"); | ||
}; | ||
luv.prototype.torgb = function (args) { | ||
@@ -589,2 +628,5 @@ return Convert_1.default.xyz2rgb(this.toxyz(args), args.colorSpace, args.referenceWhite, args.round, args.bitDepth); | ||
} | ||
ypbpr.prototype.toString = function () { | ||
return "ypbpr: { y: ".concat(this.y, ", pb: ").concat(this.pb, ", pr: ").concat(this.pr, ", kb: ").concat(this.kb, ", kr: ").concat(this.kr, " }"); | ||
}; | ||
ypbpr.prototype.torgb = function (args) { | ||
@@ -632,2 +674,5 @@ if (typeof args.kb === 'undefined' || typeof args.kr === 'undefined') { | ||
} | ||
ycbcr.prototype.toString = function () { | ||
return "ycbcr: { y: ".concat(this.y, ", cb: ").concat(this.cb, ", cr: ").concat(this.cr, ", yLower: ").concat(this.yLower, ", yUpper: ").concat(this.yUpper, ", cLower: ").concat(this.cLower, ", cUpper: ").concat(this.cUpper, " }"); | ||
}; | ||
ycbcr.prototype.torgb = function (args) { | ||
@@ -664,2 +709,5 @@ if (typeof args.kb === 'undefined' || typeof args.kr === 'undefined') { | ||
} | ||
nm.prototype.toString = function () { | ||
return "nm: { wavelength: ".concat(this.wavelength, " }"); | ||
}; | ||
nm.prototype.torgb = function (args) { | ||
@@ -679,2 +727,5 @@ return Convert_1.default.nm2rgb(this, args.gamma, args.round, args.bitDepth); | ||
} | ||
kelvin.prototype.toString = function () { | ||
return "kelvin: { k: ".concat(this.k, " }"); | ||
}; | ||
kelvin.prototype.torgb = function (args) { | ||
@@ -681,0 +732,0 @@ return Convert_1.default.kelvin2rgb(this, args.round, args.bitDepth); |
@@ -450,9 +450,9 @@ "use strict"; | ||
colorType.prototype.toxyy = function (args) { | ||
return Convert_1.default.xyz2xyy(this.toxyz(args)); | ||
return Convert_1.default.xyz2xyy(this.toxyz(args), args.referenceWhite); | ||
}; | ||
colorType.prototype.tolab = function (args) { | ||
return Convert_1.default.xyz2lab(this.toxyz(args)); | ||
return Convert_1.default.xyz2lab(this.toxyz(args), args.referenceWhite, args.round); | ||
}; | ||
colorType.prototype.toluv = function (args) { | ||
return Convert_1.default.xyz2luv(this.toxyz(args)); | ||
return Convert_1.default.xyz2luv(this.toxyz(args), args.referenceWhite, args.round); | ||
}; | ||
@@ -459,0 +459,0 @@ colorType.prototype.toypbpr = function (args) { |
@@ -47,2 +47,11 @@ import * as Colors from './Colors'; | ||
/** | ||
* Convert RGB to HSI | ||
* Saturation and Intensity are in percentages | ||
* | ||
* @param {Colors.rgb} rgb | ||
* @param {boolean} [round=true] | ||
* @return {Colors.hsi} | ||
*/ | ||
static rgb2hsi_deprecated(rgb: Colors.rgb, round?: boolean): Colors.hsi; | ||
/** | ||
* Convert HSV to RGB | ||
@@ -118,22 +127,12 @@ * Saturation and Value should be in percentages | ||
/** | ||
* Convert HSI to HSV | ||
* Saturation(I) and Intensity should be in percentages | ||
* Saturation(V) and Value will be in percentages | ||
* Convert HSI to RGB | ||
* Saturation and Intensity should be in percentages | ||
* | ||
* @param {Colors.hsi} hsi | ||
* @param {boolean} [round=true] | ||
* @return {Colors.hsv} | ||
* @param {number} [bitDepth=8] | ||
* @return {Colors.rgb} | ||
*/ | ||
static hsi2hsv(hsi: Colors.hsi, round?: boolean): Colors.hsv; | ||
static hsi2rgb_deprecated(hsi: Colors.hsi, round?: boolean, bitDepth?: number): Colors.rgb; | ||
/** | ||
* Convert HSI to HSL | ||
* Saturation(I) and Intensity should be in percentages | ||
* Saturation(L) and Lightness will be in percentages | ||
* | ||
* @param {Colors.hsi} hsi | ||
* @param {boolean} [round=true] | ||
* @return {Colors.hsl} | ||
*/ | ||
static hsi2hsl(hsi: Colors.hsi, round?: boolean): Colors.hsl; | ||
/** | ||
* Convert RGB to HSP | ||
@@ -140,0 +139,0 @@ * Saturation and Perceived Brightness will be in percentages |
{ | ||
"name": "chromaticity-color-utilities", | ||
"version": "0.4.0-alpha", | ||
"version": "0.5.0-alpha", | ||
"description": "Color utilities for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.js", |
@@ -64,4 +64,10 @@ # <img src="https://reiniiriarios.github.io/chromaticity-color-utilities/assets/images/chromaticity-icon-01.png" width="26" height="26"> chromaticity-color-utilities | ||
Approaching complete-ish stage... Most conversion tests pass. Issues with XYZ. Writing tests for schemes, mods. | ||
Approaching complete-ish stage... Most tests pass. | ||
### Known Issues | ||
- L\*a\*b\* failing | ||
- L\*u\*v\* failing | ||
- HSP > RGB failing in one case | ||
## Documentation | ||
@@ -68,0 +74,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
272826
6422
174