color-convert
Advanced tools
Comparing version 1.6.0 to 1.7.0
@@ -29,3 +29,4 @@ /* MIT license */ | ||
hcg: {channels: 3}, | ||
apple: {channels: 3} | ||
apple: {channels: 3}, | ||
gray: {channels: 1} | ||
}; | ||
@@ -810,1 +811,34 @@ | ||
}; | ||
convert.gray.rgb = function (args) { | ||
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; | ||
}; | ||
convert.gray.hsl = convert.gray.hsv = function (args) { | ||
return [0, 0, args[0]]; | ||
}; | ||
convert.gray.hwb = function (gray) { | ||
return [0, 100, gray[0]]; | ||
}; | ||
convert.gray.cmyk = function (gray) { | ||
return [0, 0, 0, gray[0]]; | ||
}; | ||
convert.gray.lab = function (gray) { | ||
return [gray[0], 0, 0]; | ||
}; | ||
convert.gray.hex = function (gray) { | ||
var val = Math.round(gray[0] / 100 * 255) & 0xFF; | ||
var integer = (val << 16) + (val << 8) + val; | ||
var string = integer.toString(16).toUpperCase(); | ||
return '000000'.substring(string.length) + string; | ||
}; | ||
convert.rgb.gray = function (rgb) { | ||
var val = (rgb[0] + rgb[1] + rgb[2]) / 3; | ||
return [val / 255 * 100]; | ||
}; |
{ | ||
"name": "color-convert", | ||
"description": "Plain color conversion functions", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"author": "Heather Arthur <fayearthur@gmail.com>", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
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
25922
811