mirror of
https://github.com/thangisme/notes.git
synced 2024-06-28 16:05:30 +00:00
12 lines
342 B
JavaScript
12 lines
342 B
JavaScript
|
module.exports = function grayscale(color) {
|
||
|
function gs () {
|
||
|
/*jslint strict:false*/
|
||
|
var rgb = this.rgb(),
|
||
|
val = rgb._red * 0.3 + rgb._green * 0.59 + rgb._blue * 0.11;
|
||
|
|
||
|
return new color.RGB(val, val, val, rgb._alpha);
|
||
|
}
|
||
|
|
||
|
color.installMethod('greyscale', gs).installMethod('grayscale', gs);
|
||
|
};
|