chromaticity-color-utilities
Advanced tools
Comparing version 0.1.11-alpha to 0.1.12-alpha
@@ -46,2 +46,3 @@ export interface newColorArgs { | ||
distanceToWhite?: number; | ||
round?: boolean; | ||
} | ||
@@ -48,0 +49,0 @@ export declare abstract class colorType { |
@@ -101,4 +101,5 @@ "use strict"; | ||
var ogargs = { | ||
round: args.round, | ||
bitDepth: this.bitDepth, | ||
normalized: this.normalized, | ||
normalize: this.normalized, | ||
colorSpace: this.colorSpace, | ||
@@ -116,3 +117,3 @@ referenceWhite: this.referenceWhite, | ||
}; | ||
var ogalpha = (typeof this.a == 'undefined' ? false : this.a); | ||
var ogalpha = this.a; | ||
var modified; | ||
@@ -134,3 +135,3 @@ switch (modification) { | ||
tmpColor2 = args.with.torgb({ round: false }); | ||
modified = Modify_1.default.rgbBlend(tmpColor1, tmpColor2, args.amount); | ||
modified = Modify_1.default.rgbBlend(tmpColor1, tmpColor2, args.amount, args.round); | ||
break; | ||
@@ -141,3 +142,3 @@ case 'hsv': | ||
tmpColor2 = args.with.tohsv({ round: false }); | ||
modified = Modify_1.default.hsvBlend(tmpColor1, tmpColor2, args.amount); | ||
modified = Modify_1.default.hsvBlend(tmpColor1, tmpColor2, args.amount, args.round); | ||
break; | ||
@@ -238,3 +239,3 @@ default: | ||
var ogModified = modified.to(og, ogargs); | ||
if (ogalpha) | ||
if (typeof ogalpha !== 'undefined') | ||
ogModified.a = ogalpha; // otherwise this gets lost on some modifications | ||
@@ -247,2 +248,19 @@ return ogModified; | ||
var og = this.constructor['name']; | ||
var ogargs = { | ||
round: args.round, | ||
bitDepth: this.bitDepth, | ||
normalize: this.normalized, | ||
colorSpace: this.colorSpace, | ||
referenceWhite: this.referenceWhite, | ||
kb: this.kb, | ||
kr: this.kr, | ||
pb: this.pb, | ||
pr: this.pr, | ||
yLower: this.yLower, | ||
yUpper: this.yUpper, | ||
cLower: this.cLower, | ||
cUpper: this.cUpper, | ||
gamma: this.gamma | ||
}; | ||
var ogalpha = this.a; | ||
var intScheme; | ||
@@ -282,4 +300,4 @@ var distance; | ||
} | ||
var distance_1 = typeof args.distanceToBlack === 'undefined' ? args.distance : args.distanceToBlack; | ||
intScheme = Harmony_1.default.shade(this.to('hsl', { round: false }), args.colors, distance_1); | ||
distance = typeof args.distanceToBlack === 'undefined' ? args.distance : args.distanceToBlack; | ||
intScheme = Harmony_1.default.shade(this.to('hsl', { round: false }), args.colors, distance); | ||
break; | ||
@@ -292,4 +310,4 @@ case 'tint': | ||
} | ||
distance_1 = typeof args.distanceToWhite === 'undefined' ? args.distance : args.distanceToWhite; | ||
intScheme = Harmony_1.default.tint(this.to('hsl', { round: false }), args.colors, distance_1); | ||
distance = typeof args.distanceToWhite === 'undefined' ? args.distance : args.distanceToWhite; | ||
intScheme = Harmony_1.default.tint(this.to('hsl', { round: false }), args.colors, distance); | ||
break; | ||
@@ -300,7 +318,9 @@ case 'tintshade': | ||
case 'shadestints': | ||
case 'lightdark': | ||
case 'darklight': | ||
if (typeof args.colors === 'undefined') { | ||
throw new Error('Must specify number of colors to include in scheme'); | ||
} | ||
distance_1 = typeof args.distanceToWhite === 'undefined' ? args.distance : args.distanceToWhite; | ||
intScheme = Harmony_1.default.shadetint(this.to('hsl', { round: false }), args.colors, distance_1, args.distanceToBlack); | ||
distance = typeof args.distanceToWhite === 'undefined' ? args.distance : args.distanceToWhite; | ||
intScheme = Harmony_1.default.shadetint(this.to('hsl', { round: false }), args.colors, distance, args.distanceToBlack); | ||
break; | ||
@@ -312,3 +332,6 @@ default: | ||
intScheme.forEach(function (color) { | ||
ogScheme.push(color.to(og)); | ||
var ogColor = color.to(og, ogargs); | ||
if (typeof ogalpha !== 'undefined') | ||
ogColor.a = ogalpha; // otherwise this gets lost on some modifications | ||
ogScheme.push(ogColor); | ||
}); | ||
@@ -315,0 +338,0 @@ return ogScheme; |
{ | ||
"name": "chromaticity-color-utilities", | ||
"version": "0.1.11-alpha", | ||
"version": "0.1.12-alpha", | ||
"description": "Color utilities for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.js", |
@@ -691,3 +691,4 @@ # chromaticity-color-utilities | ||
amount: number, // optional, 0 - 1, defaults to 0.5 | ||
method: string // optional, defaults to 'rgb' | ||
method: string, // optional, defaults to 'rgb' | ||
round: boolean // optional, defaults to true | ||
}) | ||
@@ -723,3 +724,3 @@ | ||
amount: number, // optional, 0 - 1, defaults to 0.5 | ||
method: string // optional, defaults to 'lightness' | ||
method: string, // optional, defaults to 'lightness' | ||
round: boolean // optional, defaults to true | ||
@@ -744,3 +745,3 @@ }) | ||
amount: number, // optional, 0 - 1, defaults to 0.5 | ||
method: string // optional, defaults to 'lightness' | ||
method: string, // optional, defaults to 'lightness' | ||
round: boolean // optional, defaults to true | ||
@@ -765,3 +766,3 @@ }) | ||
amount: number, // optional, 0 - 1, defaults to 0.5 | ||
method: string // optional, defaults to 'hsl' | ||
method: string, // optional, defaults to 'hsl' | ||
round: boolean // optional, defaults to true | ||
@@ -787,3 +788,3 @@ }) | ||
amount: number, // optional, 0 - 1, defaults to 0.5 | ||
method: string // optional, defaults to 'hsl' | ||
method: string, // optional, defaults to 'hsl' | ||
round: boolean // optional, defaults to true | ||
@@ -790,0 +791,0 @@ }) |
289457
15
5594
1728