{"action":"created","comment":{"url":"https://api.github.com/repos/pebble/pebblejs/pulls/comments/40844857","id":40844857,"diff_hunk":"@@ -140,7 +207,43 @@ var colorMap = {\n };\n \n var Color = function(color) {\n-  return colorMap[color] ? colorMap[color] : colorMap.clear;\n+  if (color.charAt(0)=='#') {\n+      //Convert full hex to shorthand\n+      if (color.length==4){\n+          var r = color.charAt(1);\n+          var g = color.charAt(2);\n+          var b = color.charAt(3);\n+          color = '#'+r+r+g+g+b+b;\n+      }\n+      //Ensure upper case\n+      color = color.toUpperCase();\n+      return hexColorMap[roundColor(color)];\n+  }\n+  return namedColorMap[color] ? namedColorMap[color] : namedColorMap.clear;\n+};\n+\n+var roundColor = function (color) {\n+    var closestTo = function(color, colors) {","path":"src/js/ui/simply-pebble.js","position":97,"original_position":97,"commit_id":"fb404f9a394a87b14c5cdd027950c3cc58a414b9","original_commit_id":"fb404f9a394a87b14c5cdd027950c3cc58a414b9","user":{"login":"Meiguro","id":4428900,"avatar_url":"https://avatars.githubusercontent.com/u/4428900?v=3","gravatar_id":"","url":"https://api.github.com/users/Meiguro","html_url":"https://github.com/Meiguro","followers_url":"https://api.github.com/users/Meiguro/followers","following_url":"https://api.github.com/users/Meiguro/following{/other_user}","gists_url":"https://api.github.com/users/Meiguro/gists{/gist_id}","starred_url":"https://api.github.com/users/Meiguro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Meiguro/subscriptions","organizations_url":"https://api.github.com/users/Meiguro/orgs","repos_url":"https://api.github.com/users/Meiguro/repos","events_url":"https://api.github.com/users/Meiguro/events{/privacy}","received_events_url":"https://api.github.com/users/Meiguro/received_events","type":"User","site_admin":false},"body":"Use 2 spaces for an indent. This includes the `hexColorMap`. I apologize that the `namedColorMap` is not correctly indented, I didn't want to enforce strict formatting for someone's first contribution.","created_at":"2015-09-30T20:11:54Z","updated_at":"2015-09-30T20:11:54Z","html_url":"https://github.com/pebble/pebblejs/pull/98#discussion_r40844857","pull_request_url":"https://api.github.com/repos/pebble/pebblejs/pulls/98","_links":{"self":{"href":"https://api.github.com/repos/pebble/pebblejs/pulls/comments/40844857"},"html":{"href":"https://github.com/pebble/pebblejs/pull/98#discussion_r40844857"},"pull_request":{"href":"https://api.github.com/repos/pebble/pebblejs/pulls/98"}}},"pull_request":{"url":"https://api.github.com/repos/pebble/pebblejs/pulls/98","id":46087620,"html_url":"https://github.com/pebble/pebblejs/pull/98","diff_url":"https://github.com/pebble/pebblejs/pull/98.diff","patch_url":"https://github.com/pebble/pebblejs/pull/98.patch","issue_url":"https://api.github.com/repos/pebble/pebblejs/issues/98","number":98,"state":"open","locked":false,"title":"Ability to enter in hex color codes w/ rounding","user":{"login":"fletchto99","id":718681,"avatar_url":"https://avatars.githubusercontent.com/u/718681?v=3","gravatar_id":"","url":"https://api.github.com/users/fletchto99","html_url":"https://github.com/fletchto99","followers_url":"https://api.github.com/users/fletchto99/followers","following_url":"https://api.github.com/users/fletchto99/following{/other_user}","gists_url":"https://api.github.com/users/fletchto99/gists{/gist_id}","starred_url":"https://api.github.com/users/fletchto99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fletchto99/subscriptions","organizations_url":"https://api.github.com/users/fletchto99/orgs","repos_url":"https://api.github.com/users/fletchto99/repos","events_url":"https://api.github.com/users/fletchto99/events{/privacy}","received_events_url":"https://api.github.com/users/fletchto99/received_events","type":"User","site_admin":false},"body":"Enables users to enter hex codes instead of color names for a color parameter. Instead of preventing invalid hex codes, we round them to the nearest Pebble color. ","created_at":"2015-09-26T19:12:38Z","updated_at":"2015-09-30T20:11:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d38bdd91c48d3f6e61dbe23e7867adb28a2ef19f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pebble/pebblejs/pulls/98/commits","review_comments_url":"https://api.github.com/repos/pebble/pebblejs/pulls/98/comments","review_comment_url":"https://api.github.com/repos/pebble/pebblejs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pebble/pebblejs/issues/98/comments","statuses_url":"https://api.github.com/repos/pebble/pebblejs/statuses/fb404f9a394a87b14c5cdd027950c3cc58a414b9","head":{"label":"fletchto99:master","ref":"master","sha":"fb404f9a394a87b14c5cdd027950c3cc58a414b9","user":{"login":"fletchto99","id":718681,"avatar_url":"https://avatars.githubusercontent.com/u/718681?v=3","gravatar_id":"","url":"https://api.github.com/users/fletchto99","html_url":"https://github.com/fletchto99","followers_url":"https://api.github.com/users/fletchto99/followers","following_url":"https://api.github.com/users/fletchto99/following{/other_user}","gists_url":"https://api.github.com/users/fletchto99/gists{/gist_id}","starred_url":"https://api.github.com/users/fletchto99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fletchto99/subscriptions","organizations_url":"https://api.github.com/users/fletchto99/orgs","repos_url":"https://api.github.com/users/fletchto99/repos","events_url":"https://api.github.com/users/fletchto99/events{/privacy}","received_events_url":"https://api.github.com/users/fletchto99/received_events","type":"User","site_admin":false},"repo":{"id":34932168,"name":"pebblejs","full_name":"fletchto99/pebblejs","owner":{"login":"fletchto99","id":718681,"avatar_url":"https://avatars.githubusercontent.com/u/718681?v=3","gravatar_id":"","url":"https://api.github.com/users/fletchto99","html_url":"https://github.com/fletchto99","followers_url":"https://api.github.com/users/fletchto99/followers","following_url":"https://api.github.com/users/fletchto99/following{/other_user}","gists_url":"https://api.github.com/users/fletchto99/gists{/gist_id}","starred_url":"https://api.github.com/users/fletchto99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fletchto99/subscriptions","organizations_url":"https://api.github.com/users/fletchto99/orgs","repos_url":"https://api.github.com/users/fletchto99/repos","events_url":"https://api.github.com/users/fletchto99/events{/privacy}","received_events_url":"https://api.github.com/users/fletchto99/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fletchto99/pebblejs","description":"Program the Pebble with simply JavaScript","fork":true,"url":"https://api.github.com/repos/fletchto99/pebblejs","forks_url":"https://api.github.com/repos/fletchto99/pebblejs/forks","keys_url":"https://api.github.com/repos/fletchto99/pebblejs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fletchto99/pebblejs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fletchto99/pebblejs/teams","hooks_url":"https://api.github.com/repos/fletchto99/pebblejs/hooks","issue_events_url":"https://api.github.com/repos/fletchto99/pebblejs/issues/events{/number}","events_url":"https://api.github.com/repos/fletchto99/pebblejs/events","assignees_url":"https://api.github.com/repos/fletchto99/pebblejs/assignees{/user}","branches_url":"https://api.github.com/repos/fletchto99/pebblejs/branches{/branch}","tags_url":"https://api.github.com/repos/fletchto99/pebblejs/tags","blobs_url":"https://api.github.com/repos/fletchto99/pebblejs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fletchto99/pebblejs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fletchto99/pebblejs/git/refs{/sha}","trees_url":"https://api.github.com/repos/fletchto99/pebblejs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fletchto99/pebblejs/statuses/{sha}","languages_url":"https://api.github.com/repos/fletchto99/pebblejs/languages","stargazers_url":"https://api.github.com/repos/fletchto99/pebblejs/stargazers","contributors_url":"https://api.github.com/repos/fletchto99/pebblejs/contributors","subscribers_url":"https://api.github.com/repos/fletchto99/pebblejs/subscribers","subscription_url":"https://api.github.com/repos/fletchto99/pebblejs/subscription","commits_url":"https://api.github.com/repos/fletchto99/pebblejs/commits{/sha}","git_commits_url":"https://api.github.com/repos/fletchto99/pebblejs/git/commits{/sha}","comments_url":"https://api.github.com/repos/fletchto99/pebblejs/comments{/number}","issue_comment_url":"https://api.github.com/repos/fletchto99/pebblejs/issues/comments{/number}","contents_url":"https://api.github.com/repos/fletchto99/pebblejs/contents/{+path}","compare_url":"https://api.github.com/repos/fletchto99/pebblejs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fletchto99/pebblejs/merges","archive_url":"https://api.github.com/repos/fletchto99/pebblejs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fletchto99/pebblejs/downloads","issues_url":"https://api.github.com/repos/fletchto99/pebblejs/issues{/number}","pulls_url":"https://api.github.com/repos/fletchto99/pebblejs/pulls{/number}","milestones_url":"https://api.github.com/repos/fletchto99/pebblejs/milestones{/number}","notifications_url":"https://api.github.com/repos/fletchto99/pebblejs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fletchto99/pebblejs/labels{/name}","releases_url":"https://api.github.com/repos/fletchto99/pebblejs/releases{/id}","created_at":"2015-05-02T01:55:28Z","updated_at":"2015-05-02T01:55:28Z","pushed_at":"2015-09-27T03:34:12Z","git_url":"git://github.com/fletchto99/pebblejs.git","ssh_url":"git@github.com:fletchto99/pebblejs.git","clone_url":"https://github.com/fletchto99/pebblejs.git","svn_url":"https://github.com/fletchto99/pebblejs","homepage":null,"size":1267,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pebble:master","ref":"master","sha":"cf976fc1cfbc4ad04e724ab5734acfff2c59f82f","user":{"login":"pebble","id":1048268,"avatar_url":"https://avatars.githubusercontent.com/u/1048268?v=3","gravatar_id":"","url":"https://api.github.com/users/pebble","html_url":"https://github.com/pebble","followers_url":"https://api.github.com/users/pebble/followers","following_url":"https://api.github.com/users/pebble/following{/other_user}","gists_url":"https://api.github.com/users/pebble/gists{/gist_id}","starred_url":"https://api.github.com/users/pebble/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pebble/subscriptions","organizations_url":"https://api.github.com/users/pebble/orgs","repos_url":"https://api.github.com/users/pebble/repos","events_url":"https://api.github.com/users/pebble/events{/privacy}","received_events_url":"https://api.github.com/users/pebble/received_events","type":"Organization","site_admin":false},"repo":{"id":20283101,"name":"pebblejs","full_name":"pebble/pebblejs","owner":{"login":"pebble","id":1048268,"avatar_url":"https://avatars.githubusercontent.com/u/1048268?v=3","gravatar_id":"","url":"https://api.github.com/users/pebble","html_url":"https://github.com/pebble","followers_url":"https://api.github.com/users/pebble/followers","following_url":"https://api.github.com/users/pebble/following{/other_user}","gists_url":"https://api.github.com/users/pebble/gists{/gist_id}","starred_url":"https://api.github.com/users/pebble/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pebble/subscriptions","organizations_url":"https://api.github.com/users/pebble/orgs","repos_url":"https://api.github.com/users/pebble/repos","events_url":"https://api.github.com/users/pebble/events{/privacy}","received_events_url":"https://api.github.com/users/pebble/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pebble/pebblejs","description":"Program the Pebble with simply JavaScript","fork":true,"url":"https://api.github.com/repos/pebble/pebblejs","forks_url":"https://api.github.com/repos/pebble/pebblejs/forks","keys_url":"https://api.github.com/repos/pebble/pebblejs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pebble/pebblejs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pebble/pebblejs/teams","hooks_url":"https://api.github.com/repos/pebble/pebblejs/hooks","issue_events_url":"https://api.github.com/repos/pebble/pebblejs/issues/events{/number}","events_url":"https://api.github.com/repos/pebble/pebblejs/events","assignees_url":"https://api.github.com/repos/pebble/pebblejs/assignees{/user}","branches_url":"https://api.github.com/repos/pebble/pebblejs/branches{/branch}","tags_url":"https://api.github.com/repos/pebble/pebblejs/tags","blobs_url":"https://api.github.com/repos/pebble/pebblejs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pebble/pebblejs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pebble/pebblejs/git/refs{/sha}","trees_url":"https://api.github.com/repos/pebble/pebblejs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pebble/pebblejs/statuses/{sha}","languages_url":"https://api.github.com/repos/pebble/pebblejs/languages","stargazers_url":"https://api.github.com/repos/pebble/pebblejs/stargazers","contributors_url":"https://api.github.com/repos/pebble/pebblejs/contributors","subscribers_url":"https://api.github.com/repos/pebble/pebblejs/subscribers","subscription_url":"https://api.github.com/repos/pebble/pebblejs/subscription","commits_url":"https://api.github.com/repos/pebble/pebblejs/commits{/sha}","git_commits_url":"https://api.github.com/repos/pebble/pebblejs/git/commits{/sha}","comments_url":"https://api.github.com/repos/pebble/pebblejs/comments{/number}","issue_comment_url":"https://api.github.com/repos/pebble/pebblejs/issues/comments{/number}","contents_url":"https://api.github.com/repos/pebble/pebblejs/contents/{+path}","compare_url":"https://api.github.com/repos/pebble/pebblejs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pebble/pebblejs/merges","archive_url":"https://api.github.com/repos/pebble/pebblejs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pebble/pebblejs/downloads","issues_url":"https://api.github.com/repos/pebble/pebblejs/issues{/number}","pulls_url":"https://api.github.com/repos/pebble/pebblejs/pulls{/number}","milestones_url":"https://api.github.com/repos/pebble/pebblejs/milestones{/number}","notifications_url":"https://api.github.com/repos/pebble/pebblejs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pebble/pebblejs/labels{/name}","releases_url":"https://api.github.com/repos/pebble/pebblejs/releases{/id}","created_at":"2014-05-29T05:22:52Z","updated_at":"2015-09-30T19:35:23Z","pushed_at":"2015-09-27T03:34:13Z","git_url":"git://github.com/pebble/pebblejs.git","ssh_url":"git@github.com:pebble/pebblejs.git","clone_url":"https://github.com/pebble/pebblejs.git","svn_url":"https://github.com/pebble/pebblejs","homepage":null,"size":1659,"stargazers_count":293,"watchers_count":293,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":137,"mirror_url":null,"open_issues_count":41,"forks":137,"open_issues":41,"watchers":293,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pebble/pebblejs/pulls/98"},"html":{"href":"https://github.com/pebble/pebblejs/pull/98"},"issue":{"href":"https://api.github.com/repos/pebble/pebblejs/issues/98"},"comments":{"href":"https://api.github.com/repos/pebble/pebblejs/issues/98/comments"},"review_comments":{"href":"https://api.github.com/repos/pebble/pebblejs/pulls/98/comments"},"review_comment":{"href":"https://api.github.com/repos/pebble/pebblejs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pebble/pebblejs/pulls/98/commits"},"statuses":{"href":"https://api.github.com/repos/pebble/pebblejs/statuses/fb404f9a394a87b14c5cdd027950c3cc58a414b9"}}}}