color-space
Advanced tools
Comparing version 1.6.0 to 1.7.0
@@ -23,2 +23,3 @@ /** | ||
ydbdr: require('./ydbdr'), | ||
ypbpr: require('./ypbpr'), | ||
lab: require('./lab'), | ||
@@ -25,0 +26,0 @@ labh: require('./labh'), |
{ | ||
"name": "color-space", | ||
"description": "Color space conversions and data", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"author": "Deema Yvanow <dfcreative@gmail.com>", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -10,3 +10,3 @@ # Color-space [![Build Status](https://travis-ci.org/dfcreative/color-space.svg?branch=master)](https://travis-ci.org/dfcreative/color-space) [![Code Climate](https://codeclimate.com/github/dfcreative/color-space/badges/gpa.svg)](https://codeclimate.com/github/dfcreative/color-space) [![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges) | ||
[![npm install color-space](https://nodei.co/npm/color-space.png?mini=true)](https://npmjs.org/package/color-space/) | ||
[`npm install color-space`](https://npmjs.org/package/color-space/) | ||
@@ -20,3 +20,3 @@ ```js | ||
Require separately: | ||
You can require a separate space to reduce size significantly: | ||
@@ -65,3 +65,3 @@ ```js | ||
* [x] [YDbDr](https://en.wikipedia.org/wiki/YDbDr) | ||
* [ ] [YPbPr](https://en.wikipedia.org/wiki/YPbPr) | ||
* [x] [YPbPr](https://en.wikipedia.org/wiki/YPbPr) | ||
* [ ] [YCbCr](https://en.wikipedia.org/wiki/YCbCr) | ||
@@ -68,0 +68,0 @@ * [ ] [YCgCo](https://en.wikipedia.org/wiki/YCgCo) |
26
ypbpr.js
/** | ||
* https://en.wikipedia.org/?title=YPbPr | ||
* | ||
* HDTV conversion is used | ||
* | ||
* @module color-space/ypbpr | ||
@@ -11,6 +13,6 @@ */ | ||
name: 'ypbpr', | ||
min: [0,-0.5,-0.5], | ||
max: [1, 0.5, 0.5], | ||
min: [0,-1.333,-1.333], | ||
max: [1, 1.333, 1.333], | ||
channel: ['Y','Pb','Pr'], | ||
alias: ['YPbPr'] | ||
alias: ['YPbPr', 'Y/PB/PR', 'YPRPB', 'PRPBY', 'PBPRY', 'Y/Pb/Pr', 'YPrPb', 'PrPbY', 'PbPrY', 'Y/R-Y/B-Y', 'Y(R-Y)(B-Y)', 'R-Y', 'B-Y'] | ||
}; | ||
@@ -27,3 +29,13 @@ | ||
ypbpr.rgb = function(ypbpr) { | ||
var y = ypbpr[0], pb = ypbpr[1], pr = ypbpr[2]; | ||
var r = pr + y; | ||
var b = pb + y; | ||
var g = (y - 0.2126*r - 0.0722*b) / 0.7152; | ||
return [ | ||
r * 255, | ||
g * 255, | ||
b * 255 | ||
]; | ||
}; | ||
@@ -40,3 +52,11 @@ | ||
rgb.ypbpr = function(rgb) { | ||
var r = rgb[0]/255, g = rgb[1]/255, b = rgb[2]/255; | ||
var y = 0.2126 * r + 0.7152 * g + 0.0722 * b; | ||
return [ | ||
y, | ||
b - y, | ||
r - y | ||
]; | ||
}; |
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
89519
2813