{"size": 478, "ext": "js", "max_stars_repo_path": "lib/plugins/luminance.js", "max_stars_repo_name": "Orchit07/one-color", "max_stars_repo_stars_event_min_datetime": "2015-01-04T02:10:25.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-05T21:21:49.000Z", "max_issues_repo_path": "lib/plugins/luminance.js", "max_issues_repo_name": "One-com/one-color", "max_issues_repo_issues_event_min_datetime": "2015-01-15T13:30:07.000Z", "max_issues_repo_issues_event_max_datetime": "2021-06-20T11:03:31.000Z", "max_forks_repo_path": "lib/plugins/luminance.js", "max_forks_repo_name": "Orchit07/one-color", "max_forks_repo_forks_event_min_datetime": "2015-02-07T05:54:27.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-29T10:44:52.000Z"}
{"max_stars_count": 254, "max_issues_count": 24, "max_forks_count": 37, "avg_line_length": 25.1578947368, "max_line_length": 54, "alphanum_fraction": 0.6129707113}
module.exports = function luminance(color) {
  // http://www.w3.org/TR/WCAG20/#relativeluminancedef

  function channelLuminance(value) {
    return value <= 0.03928
      ? value / 12.92
      : Math.pow((value + 0.055) / 1.055, 2.4);
  }

  color.installMethod('luminance', function () {
    var rgb = this.rgb();
    return (
      0.2126 * channelLuminance(rgb._red) +
      0.7152 * channelLuminance(rgb._green) +
      0.0722 * channelLuminance(rgb._blue)
    );
  });
};
