chromaticity-color-utilities
Advanced tools
Comparing version 0.1.12-alpha to 0.1.13-alpha
@@ -516,2 +516,8 @@ "use strict"; | ||
rgb.prototype.torgb = function (args) { | ||
if (args.round) { | ||
this.r = Math.round(this.r); | ||
this.g = Math.round(this.g); | ||
this.b = Math.round(this.b); | ||
this.a = Math.round(this.a); | ||
} | ||
return this; | ||
@@ -550,2 +556,8 @@ }; | ||
rec709rgb.prototype.torec709 = function (args) { | ||
if (args.round) { | ||
this.r = Math.round(this.r); | ||
this.g = Math.round(this.g); | ||
this.b = Math.round(this.b); | ||
this.a = Math.round(this.a); | ||
} | ||
return this; | ||
@@ -584,2 +596,8 @@ }; | ||
rec2020rgb.prototype.torec2020 = function (args) { | ||
if (args.round) { | ||
this.r = Math.round(this.r); | ||
this.g = Math.round(this.g); | ||
this.b = Math.round(this.b); | ||
this.a = Math.round(this.a); | ||
} | ||
return this; | ||
@@ -609,2 +627,8 @@ }; | ||
hsv.prototype.tohsv = function (args) { | ||
if (args.round) { | ||
this.h = Math.round(this.h); | ||
this.s = Math.round(this.s); | ||
this.v = Math.round(this.v); | ||
this.a = Math.round(this.a); | ||
} | ||
return this; | ||
@@ -643,2 +667,8 @@ }; | ||
hsl.prototype.tohsl = function (args) { | ||
if (args.round) { | ||
this.h = Math.round(this.h); | ||
this.s = Math.round(this.s); | ||
this.l = Math.round(this.l); | ||
this.a = Math.round(this.a); | ||
} | ||
return this; | ||
@@ -677,2 +707,8 @@ }; | ||
hsi.prototype.tohsi = function (args) { | ||
if (args.round) { | ||
this.h = Math.round(this.h); | ||
this.s = Math.round(this.s); | ||
this.i = Math.round(this.i); | ||
this.a = Math.round(this.a); | ||
} | ||
return this; | ||
@@ -710,2 +746,8 @@ }; | ||
hsp.prototype.tohsb = function (args) { | ||
if (args.round) { | ||
this.h = Math.round(this.h); | ||
this.s = Math.round(this.s); | ||
this.p = Math.round(this.p); | ||
this.a = Math.round(this.a); | ||
} | ||
return this; | ||
@@ -734,2 +776,8 @@ }; | ||
cmyk.prototype.tocmyk = function (args) { | ||
if (args.round) { | ||
this.c = Math.round(this.c); | ||
this.m = Math.round(this.m); | ||
this.y = Math.round(this.y); | ||
this.k = Math.round(this.k); | ||
} | ||
return this; | ||
@@ -773,2 +821,7 @@ }; | ||
yiq.prototype.toyiq = function (args) { | ||
if (args.round) { | ||
this.y = Math.round(this.y); | ||
this.i = Math.round(this.i); | ||
this.q = Math.round(this.q); | ||
} | ||
return this; | ||
@@ -859,2 +912,7 @@ }; | ||
lab.prototype.tolab = function (args) { | ||
if (args.round) { | ||
this.l = Math.round(this.l); | ||
this.a = Math.round(this.a); | ||
this.b = Math.round(this.b); | ||
} | ||
return this; | ||
@@ -896,2 +954,7 @@ }; | ||
luv.prototype.toluv = function (args) { | ||
if (args.round) { | ||
this.l = Math.round(this.l); | ||
this.u = Math.round(this.u); | ||
this.v = Math.round(this.v); | ||
} | ||
return this; | ||
@@ -968,2 +1031,7 @@ }; | ||
ycbcr.prototype.toycbcr = function (args) { | ||
if (args.round) { | ||
this.y = Math.round(this.y); | ||
this.cb = Math.round(this.cb); | ||
this.cr = Math.round(this.cr); | ||
} | ||
return this; | ||
@@ -970,0 +1038,0 @@ }; |
@@ -154,3 +154,3 @@ "use strict"; | ||
var hsls = []; | ||
var start, tEnd, sEnd, tSeparation, sSeparation; | ||
var tEnd, sEnd, tSeparation, sSeparation; | ||
if (typeof distanceShade === 'undefined') { | ||
@@ -157,0 +157,0 @@ if (100 - hsl.l < hsl.l) { |
{ | ||
"name": "chromaticity-color-utilities", | ||
"version": "0.1.12-alpha", | ||
"version": "0.1.13-alpha", | ||
"description": "Color utilities for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.js", |
@@ -22,3 +22,3 @@ # chromaticity-color-utilities | ||
* [XYZ: CIE XYZ](#xyz--cie-xyz) | ||
* [xyY: CIE xyY](#xyy-cie-xyy) | ||
* [xyY: CIE xyY](#xyy--cie-xyy) | ||
* [Lab: CIELAB / L\*a\*b\*](#lab--cielab--lab) | ||
@@ -801,7 +801,3 @@ * [Luv: CIELUV / L\*u\*v\*](#luv--cieluv--luv) | ||
```ts | ||
.scheme(type: string) | ||
// or | ||
.scheme(type: string, { | ||
angle: number // optional, hue shift angle in degrees | ||
}) | ||
.scheme(type: string, args?: {}) | ||
``` | ||
@@ -814,3 +810,5 @@ | ||
```ts | ||
.scheme('complement') // angle = 180 | ||
.scheme('complement', { // angle = 180 | ||
round: boolean // optional, defaults to true | ||
}) | ||
@@ -831,9 +829,12 @@ // e.g. | ||
.scheme('analogous', { | ||
angle: number // optional, default = 30 | ||
angle: number, // optional, default = 30 | ||
round: boolean // optional, defaults to true | ||
}) | ||
.scheme('triadic', { | ||
angle: number // optional, default = 120 | ||
angle: number, // optional, default = 120 | ||
round: boolean // optional, defaults to true | ||
}) | ||
.scheme('splitcomplement', { | ||
angle: number // optional, default = 150 | ||
angle: number, // optional, default = 150 | ||
round: boolean // optional, defaults to true | ||
}) | ||
@@ -868,5 +869,8 @@ | ||
.scheme('tetradic', { | ||
angle: number // optional, default = 45 | ||
angle: number, // optional, default = 45 | ||
round: boolean // optional, defaults to true | ||
}) | ||
.scheme('square') // angle = 90 | ||
.scheme('square', { | ||
round: boolean // optional, defaults to true | ||
}) // angle = 90 | ||
@@ -894,4 +898,5 @@ // e.g. | ||
.scheme('tint',{ | ||
colors: number, // REQUIRED, number of colors in scheme | ||
distance: number // optional, 0-1, defaults to 1, how close to white scheme should reach | ||
colors: number, // REQUIRED, number of colors in scheme | ||
distance: number, // optional, 0-1, defaults to 1, how close to white scheme should reach | ||
round: boolean // optional, defaults to true | ||
}) | ||
@@ -921,4 +926,5 @@ | ||
.scheme('shade',{ | ||
length: number, // REQUIRED, number of colors in scheme | ||
distance: number // optional, 0-1, defaults to 1, how close to black scheme should reach | ||
length: number, // REQUIRED, number of colors in scheme | ||
distance: number, // optional, 0-1, defaults to 1, how close to black scheme should reach | ||
round: boolean // optional, defaults to true | ||
}) | ||
@@ -954,3 +960,4 @@ | ||
distanceToWhite: number, // optional, 0-1, defaults to 1 | ||
distanceToBlack: number // optional, 0-1, defaults to 1 | ||
distanceToBlack: number, // optional, 0-1, defaults to 1 | ||
round: boolean // optional, defaults to true | ||
}) | ||
@@ -957,0 +964,0 @@ |
292138
5662
1735