{"action":"created","comment":{"url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/pulls/comments/58497253","id":58497253,"diff_hunk":"@@ -44,13 +44,39 @@ Template.labels.helpers({\n     // Return labels\n     return instance.labels.get();\n   },\n-  'enhanceFontColor': function (color) {\n+  'enhanceFontContrast': function (color) {\n+    /*\n+    Change label's font color to maximize contrast with the label color\n+    */\n \n-    // This template helper changes label's font color\n-    // Since by defalt font color is white (#ffffff),\n-    // so when the label's background-color is also white,\n-    // its text is invisible. This simply makes font color more darker.\n+    // Convert fiven HEX to RGB array [r, g, b]\n+    const labelColorRgb = convertHexToRgb(color);\n \n-    return (color === 'ffffff') ? '777777' : 'ffffff';\n+    // Calculate color brightness - http://www.w3.org/TR/AERT#color-contrast\n+    const colorBrightness = Math.round(((parseInt(labelColorRgb[0]) * 299) + (parseInt(labelColorRgb[1]) * 587) + (parseInt(labelColorRgb[2]) * 114)) /1000);","path":"client/labels/labels.js","position":19,"original_position":19,"commit_id":"3418a3a317dadb23834e5b9a32ba54c26baa85e6","original_commit_id":"3418a3a317dadb23834e5b9a32ba54c26baa85e6","user":{"login":"brylie","id":17307,"avatar_url":"https://avatars.githubusercontent.com/u/17307?v=3","gravatar_id":"","url":"https://api.github.com/users/brylie","html_url":"https://github.com/brylie","followers_url":"https://api.github.com/users/brylie/followers","following_url":"https://api.github.com/users/brylie/following{/other_user}","gists_url":"https://api.github.com/users/brylie/gists{/gist_id}","starred_url":"https://api.github.com/users/brylie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brylie/subscriptions","organizations_url":"https://api.github.com/users/brylie/orgs","repos_url":"https://api.github.com/users/brylie/repos","events_url":"https://api.github.com/users/brylie/events{/privacy}","received_events_url":"https://api.github.com/users/brylie/received_events","type":"User","site_admin":false},"body":"Really cool. Can we break this line into a few components, such as R G B components and a final Math.round step, so that it is easier to read?","created_at":"2016-04-05T07:30:33Z","updated_at":"2016-04-05T07:30:33Z","html_url":"https://github.com/Digipalvelutehdas/github-viewer/pull/34#discussion_r58497253","pull_request_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/pulls/34","_links":{"self":{"href":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/pulls/comments/58497253"},"html":{"href":"https://github.com/Digipalvelutehdas/github-viewer/pull/34#discussion_r58497253"},"pull_request":{"href":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/pulls/34","id":64454129,"html_url":"https://github.com/Digipalvelutehdas/github-viewer/pull/34","diff_url":"https://github.com/Digipalvelutehdas/github-viewer/pull/34.diff","patch_url":"https://github.com/Digipalvelutehdas/github-viewer/pull/34.patch","issue_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/issues/34","number":34,"state":"open","locked":false,"title":"Feature/label contrast helper","user":{"login":"brylie","id":17307,"avatar_url":"https://avatars.githubusercontent.com/u/17307?v=3","gravatar_id":"","url":"https://api.github.com/users/brylie","html_url":"https://github.com/brylie","followers_url":"https://api.github.com/users/brylie/followers","following_url":"https://api.github.com/users/brylie/following{/other_user}","gists_url":"https://api.github.com/users/brylie/gists{/gist_id}","starred_url":"https://api.github.com/users/brylie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brylie/subscriptions","organizations_url":"https://api.github.com/users/brylie/orgs","repos_url":"https://api.github.com/users/brylie/repos","events_url":"https://api.github.com/users/brylie/events{/privacy}","received_events_url":"https://api.github.com/users/brylie/received_events","type":"User","site_admin":false},"body":"Closes #33 \r\n\r\n# Changes\r\n- Update label template helper to increase font contrast\r\n- Change label markup to unordered list","created_at":"2016-03-29T12:01:31Z","updated_at":"2016-04-05T07:30:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a5704522c99c5fdab184a62d30588623f9dc6b21","assignee":{"login":"frenchbread","id":2122679,"avatar_url":"https://avatars.githubusercontent.com/u/2122679?v=3","gravatar_id":"","url":"https://api.github.com/users/frenchbread","html_url":"https://github.com/frenchbread","followers_url":"https://api.github.com/users/frenchbread/followers","following_url":"https://api.github.com/users/frenchbread/following{/other_user}","gists_url":"https://api.github.com/users/frenchbread/gists{/gist_id}","starred_url":"https://api.github.com/users/frenchbread/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frenchbread/subscriptions","organizations_url":"https://api.github.com/users/frenchbread/orgs","repos_url":"https://api.github.com/users/frenchbread/repos","events_url":"https://api.github.com/users/frenchbread/events{/privacy}","received_events_url":"https://api.github.com/users/frenchbread/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/pulls/34/commits","review_comments_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/pulls/34/comments","review_comment_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/issues/34/comments","statuses_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/statuses/3418a3a317dadb23834e5b9a32ba54c26baa85e6","head":{"label":"Digipalvelutehdas:feature/label-contrast-helper","ref":"feature/label-contrast-helper","sha":"3418a3a317dadb23834e5b9a32ba54c26baa85e6","user":{"login":"Digipalvelutehdas","id":12421888,"avatar_url":"https://avatars.githubusercontent.com/u/12421888?v=3","gravatar_id":"","url":"https://api.github.com/users/Digipalvelutehdas","html_url":"https://github.com/Digipalvelutehdas","followers_url":"https://api.github.com/users/Digipalvelutehdas/followers","following_url":"https://api.github.com/users/Digipalvelutehdas/following{/other_user}","gists_url":"https://api.github.com/users/Digipalvelutehdas/gists{/gist_id}","starred_url":"https://api.github.com/users/Digipalvelutehdas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Digipalvelutehdas/subscriptions","organizations_url":"https://api.github.com/users/Digipalvelutehdas/orgs","repos_url":"https://api.github.com/users/Digipalvelutehdas/repos","events_url":"https://api.github.com/users/Digipalvelutehdas/events{/privacy}","received_events_url":"https://api.github.com/users/Digipalvelutehdas/received_events","type":"Organization","site_admin":false},"repo":{"id":53932987,"name":"github-viewer","full_name":"Digipalvelutehdas/github-viewer","owner":{"login":"Digipalvelutehdas","id":12421888,"avatar_url":"https://avatars.githubusercontent.com/u/12421888?v=3","gravatar_id":"","url":"https://api.github.com/users/Digipalvelutehdas","html_url":"https://github.com/Digipalvelutehdas","followers_url":"https://api.github.com/users/Digipalvelutehdas/followers","following_url":"https://api.github.com/users/Digipalvelutehdas/following{/other_user}","gists_url":"https://api.github.com/users/Digipalvelutehdas/gists{/gist_id}","starred_url":"https://api.github.com/users/Digipalvelutehdas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Digipalvelutehdas/subscriptions","organizations_url":"https://api.github.com/users/Digipalvelutehdas/orgs","repos_url":"https://api.github.com/users/Digipalvelutehdas/repos","events_url":"https://api.github.com/users/Digipalvelutehdas/events{/privacy}","received_events_url":"https://api.github.com/users/Digipalvelutehdas/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Digipalvelutehdas/github-viewer","description":"Test project to fetch and display information about a Github repository","fork":false,"url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer","forks_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/forks","keys_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/teams","hooks_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/hooks","issue_events_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/issues/events{/number}","events_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/events","assignees_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/assignees{/user}","branches_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/branches{/branch}","tags_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/tags","blobs_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/git/refs{/sha}","trees_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/statuses/{sha}","languages_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/languages","stargazers_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/stargazers","contributors_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/contributors","subscribers_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/subscribers","subscription_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/subscription","commits_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/commits{/sha}","git_commits_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/git/commits{/sha}","comments_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/comments{/number}","issue_comment_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/issues/comments{/number}","contents_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/contents/{+path}","compare_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/merges","archive_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/downloads","issues_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/issues{/number}","pulls_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/pulls{/number}","milestones_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/milestones{/number}","notifications_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/labels{/name}","releases_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/releases{/id}","deployments_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/deployments","created_at":"2016-03-15T09:51:57Z","updated_at":"2016-03-16T12:13:30Z","pushed_at":"2016-04-05T04:05:48Z","git_url":"git://github.com/Digipalvelutehdas/github-viewer.git","ssh_url":"git@github.com:Digipalvelutehdas/github-viewer.git","clone_url":"https://github.com/Digipalvelutehdas/github-viewer.git","svn_url":"https://github.com/Digipalvelutehdas/github-viewer","homepage":null,"size":900,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":0,"default_branch":"develop"}},"base":{"label":"Digipalvelutehdas:develop","ref":"develop","sha":"3875491d9ba545f0bda6939b48c4bb1eb813e3cd","user":{"login":"Digipalvelutehdas","id":12421888,"avatar_url":"https://avatars.githubusercontent.com/u/12421888?v=3","gravatar_id":"","url":"https://api.github.com/users/Digipalvelutehdas","html_url":"https://github.com/Digipalvelutehdas","followers_url":"https://api.github.com/users/Digipalvelutehdas/followers","following_url":"https://api.github.com/users/Digipalvelutehdas/following{/other_user}","gists_url":"https://api.github.com/users/Digipalvelutehdas/gists{/gist_id}","starred_url":"https://api.github.com/users/Digipalvelutehdas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Digipalvelutehdas/subscriptions","organizations_url":"https://api.github.com/users/Digipalvelutehdas/orgs","repos_url":"https://api.github.com/users/Digipalvelutehdas/repos","events_url":"https://api.github.com/users/Digipalvelutehdas/events{/privacy}","received_events_url":"https://api.github.com/users/Digipalvelutehdas/received_events","type":"Organization","site_admin":false},"repo":{"id":53932987,"name":"github-viewer","full_name":"Digipalvelutehdas/github-viewer","owner":{"login":"Digipalvelutehdas","id":12421888,"avatar_url":"https://avatars.githubusercontent.com/u/12421888?v=3","gravatar_id":"","url":"https://api.github.com/users/Digipalvelutehdas","html_url":"https://github.com/Digipalvelutehdas","followers_url":"https://api.github.com/users/Digipalvelutehdas/followers","following_url":"https://api.github.com/users/Digipalvelutehdas/following{/other_user}","gists_url":"https://api.github.com/users/Digipalvelutehdas/gists{/gist_id}","starred_url":"https://api.github.com/users/Digipalvelutehdas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Digipalvelutehdas/subscriptions","organizations_url":"https://api.github.com/users/Digipalvelutehdas/orgs","repos_url":"https://api.github.com/users/Digipalvelutehdas/repos","events_url":"https://api.github.com/users/Digipalvelutehdas/events{/privacy}","received_events_url":"https://api.github.com/users/Digipalvelutehdas/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Digipalvelutehdas/github-viewer","description":"Test project to fetch and display information about a Github repository","fork":false,"url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer","forks_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/forks","keys_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/teams","hooks_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/hooks","issue_events_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/issues/events{/number}","events_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/events","assignees_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/assignees{/user}","branches_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/branches{/branch}","tags_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/tags","blobs_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/git/refs{/sha}","trees_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/statuses/{sha}","languages_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/languages","stargazers_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/stargazers","contributors_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/contributors","subscribers_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/subscribers","subscription_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/subscription","commits_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/commits{/sha}","git_commits_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/git/commits{/sha}","comments_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/comments{/number}","issue_comment_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/issues/comments{/number}","contents_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/contents/{+path}","compare_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/merges","archive_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/downloads","issues_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/issues{/number}","pulls_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/pulls{/number}","milestones_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/milestones{/number}","notifications_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/labels{/name}","releases_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/releases{/id}","deployments_url":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/deployments","created_at":"2016-03-15T09:51:57Z","updated_at":"2016-03-16T12:13:30Z","pushed_at":"2016-04-05T04:05:48Z","git_url":"git://github.com/Digipalvelutehdas/github-viewer.git","ssh_url":"git@github.com:Digipalvelutehdas/github-viewer.git","clone_url":"https://github.com/Digipalvelutehdas/github-viewer.git","svn_url":"https://github.com/Digipalvelutehdas/github-viewer","homepage":null,"size":900,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/pulls/34"},"html":{"href":"https://github.com/Digipalvelutehdas/github-viewer/pull/34"},"issue":{"href":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/issues/34"},"comments":{"href":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/Digipalvelutehdas/github-viewer/statuses/3418a3a317dadb23834e5b9a32ba54c26baa85e6"}}}}