color-convert
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -16,16 +16,29 @@ /* MIT license */ | ||
var convert = module.exports = { | ||
rgb: {}, | ||
hsl: {}, | ||
hsv: {}, | ||
hwb: {}, | ||
cmyk: {}, | ||
xyz: {}, | ||
lab: {}, | ||
lch: {}, | ||
hex: {}, | ||
keyword: {}, | ||
ansi16: {}, | ||
ansi256: {} | ||
rgb: {channels: 3}, | ||
hsl: {channels: 3}, | ||
hsv: {channels: 3}, | ||
hwb: {channels: 3}, | ||
cmyk: {channels: 4}, | ||
xyz: {channels: 3}, | ||
lab: {channels: 3}, | ||
lch: {channels: 3}, | ||
hex: {channels: 1}, | ||
keyword: {channels: 1}, | ||
ansi16: {channels: 1}, | ||
ansi256: {channels: 1} | ||
}; | ||
// hide .channels property | ||
for (var model in convert) { | ||
if (convert.hasOwnProperty(model)) { | ||
if (!('channels' in convert[model])) { | ||
throw new Error('missing channels property: ' + model); | ||
} | ||
var channels = convert[model].channels; | ||
delete convert[model].channels; | ||
Object.defineProperty(convert[model], 'channels', {value: channels}); | ||
} | ||
} | ||
convert.rgb.hsl = function (rgb) { | ||
@@ -32,0 +45,0 @@ var r = rgb[0] / 255; |
@@ -64,2 +64,4 @@ var conversions = require('./conversions'); | ||
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); | ||
var routes = route(fromModel); | ||
@@ -66,0 +68,0 @@ var routeModels = Object.keys(routes); |
{ | ||
"name": "color-convert", | ||
"description": "Plain color conversion functions", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"author": "Heather Arthur <fayearthur@gmail.com>", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -42,3 +42,3 @@ # color-convert | ||
Not that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.) | ||
Note that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.) | ||
@@ -45,0 +45,0 @@ ```js |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
25206
773
0