payload: {"action":"created","comment":{"url":"https://api.github.com/repos/elementary/granite/pulls/comments/281371863","pull_request_review_id":234213412,"id":281371863,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI4MTM3MTg2Mw==","diff_hunk":"@@ -204,6 +204,68 @@ public static string markup_accel_tooltip (string[]? accels, string? description\n     return string.joinv (\"\\n\", parts);\n }\n \n+private double contrast_ratio (Gdk.RGBA bg_color, Gdk.RGBA fg_color) {\n+    var bg_luminance = get_luminance (bg_color);\n+    var fg_luminance = get_luminance (fg_color);\n+\n+    if (bg_luminance > fg_luminance) {\n+        return (bg_luminance + 0.05) / (fg_luminance + 0.05);\n+    }\n+\n+    return (fg_luminance + 0.05) / (bg_luminance + 0.05);\n+}\n+\n+private double get_luminance (Gdk.RGBA color) {\n+    var red = sanitize_color (color.red) * 0.2126;\n+    var green = sanitize_color (color.green) * 0.7152;\n+    var blue = sanitize_color (color.blue) * 0.0722;\n+\n+    return (red + green + blue);\n+}\n+\n+private double sanitize_color (double color) {\n+    if (color <= 0.03928) {\n+        return color / 12.92;\n+    }\n+\n+    return Math.pow ((color + 0.055) / 1.055, 2.4);\n+}\n+\n+/**\n+ * Takes a {@link Gdk.RGBA} background color and returns a suitably-contrasting foreground color, i.e. for determining text color on a colored background.\n+ *\n+ * @param bg_color a {@link Gdk.RGBA} background color\n+ *\n+ * @return a contrasting {@link Gdk.RGBA} foreground color\n+ */\n+public static Gdk.RGBA contrasting_foreground_color (Gdk.RGBA bg_color) {\n+    var gdk_white = Gdk.RGBA ();\n+    gdk_white.parse (\"#fff\");\n+\n+    var gdk_black = Gdk.RGBA ();\n+    gdk_black.parse (\"#000\");","path":"lib/Widgets/Utils.vala","position":43,"original_position":43,"commit_id":"645306a847d8c86dc5255b4f35182b08e0f0c4ce","original_commit_id":"645306a847d8c86dc5255b4f35182b08e0f0c4ce","user":{"login":"donadigo","id":8205284,"node_id":"MDQ6VXNlcjgyMDUyODQ=","avatar_url":"https://avatars3.githubusercontent.com/u/8205284?v=4","gravatar_id":"","url":"https://api.github.com/users/donadigo","html_url":"https://github.com/donadigo","followers_url":"https://api.github.com/users/donadigo/followers","following_url":"https://api.github.com/users/donadigo/following{/other_user}","gists_url":"https://api.github.com/users/donadigo/gists{/gist_id}","starred_url":"https://api.github.com/users/donadigo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donadigo/subscriptions","organizations_url":"https://api.github.com/users/donadigo/orgs","repos_url":"https://api.github.com/users/donadigo/repos","events_url":"https://api.github.com/users/donadigo/events{/privacy}","received_events_url":"https://api.github.com/users/donadigo/received_events","type":"User","site_admin":false},"body":"Same here:\r\n`Gdk.RGBA gdk_black = { 0.0, 0.0, 0.0, 1.0 };`","created_at":"2019-05-06T21:34:21Z","updated_at":"2019-05-06T21:48:51Z","html_url":"https://github.com/elementary/granite/pull/284#discussion_r281371863","pull_request_url":"https://api.github.com/repos/elementary/granite/pulls/284","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/elementary/granite/pulls/comments/281371863"},"html":{"href":"https://github.com/elementary/granite/pull/284#discussion_r281371863"},"pull_request":{"href":"https://api.github.com/repos/elementary/granite/pulls/284"}}},"pull_request":{"url":"https://api.github.com/repos/elementary/granite/pulls/284","id":276346480,"node_id":"MDExOlB1bGxSZXF1ZXN0Mjc2MzQ2NDgw","html_url":"https://github.com/elementary/granite/pull/284","diff_url":"https://github.com/elementary/granite/pull/284.diff","patch_url":"https://github.com/elementary/granite/pull/284.patch","issue_url":"https://api.github.com/repos/elementary/granite/issues/284","number":284,"state":"open","locked":false,"title":"Contrasting foreground color","user":{"login":"cassidyjames","id":611168,"node_id":"MDQ6VXNlcjYxMTE2OA==","avatar_url":"https://avatars1.githubusercontent.com/u/611168?v=4","gravatar_id":"","url":"https://api.github.com/users/cassidyjames","html_url":"https://github.com/cassidyjames","followers_url":"https://api.github.com/users/cassidyjames/followers","following_url":"https://api.github.com/users/cassidyjames/following{/other_user}","gists_url":"https://api.github.com/users/cassidyjames/gists{/gist_id}","starred_url":"https://api.github.com/users/cassidyjames/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cassidyjames/subscriptions","organizations_url":"https://api.github.com/users/cassidyjames/orgs","repos_url":"https://api.github.com/users/cassidyjames/repos","events_url":"https://api.github.com/users/cassidyjames/events{/privacy}","received_events_url":"https://api.github.com/users/cassidyjames/received_events","type":"User","site_admin":false},"body":"Fixes #244. Input welcome.\r\n\r\n![image](https://user-images.githubusercontent.com/611168/57256237-54265a80-7013-11e9-996c-99283d048bfd.png)\r\n","created_at":"2019-05-06T21:24:53Z","updated_at":"2019-05-06T21:48:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e0fa65ca0e78cf3501185bdbff8519eb513cf74a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/elementary/granite/pulls/284/commits","review_comments_url":"https://api.github.com/repos/elementary/granite/pulls/284/comments","review_comment_url":"https://api.github.com/repos/elementary/granite/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elementary/granite/issues/284/comments","statuses_url":"https://api.github.com/repos/elementary/granite/statuses/645306a847d8c86dc5255b4f35182b08e0f0c4ce","head":{"label":"elementary:contasting-color","ref":"contasting-color","sha":"645306a847d8c86dc5255b4f35182b08e0f0c4ce","user":{"login":"elementary","id":1978534,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5Nzg1MzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1978534?v=4","gravatar_id":"","url":"https://api.github.com/users/elementary","html_url":"https://github.com/elementary","followers_url":"https://api.github.com/users/elementary/followers","following_url":"https://api.github.com/users/elementary/following{/other_user}","gists_url":"https://api.github.com/users/elementary/gists{/gist_id}","starred_url":"https://api.github.com/users/elementary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elementary/subscriptions","organizations_url":"https://api.github.com/users/elementary/orgs","repos_url":"https://api.github.com/users/elementary/repos","events_url":"https://api.github.com/users/elementary/events{/privacy}","received_events_url":"https://api.github.com/users/elementary/received_events","type":"Organization","site_admin":false},"repo":{"id":89004917,"node_id":"MDEwOlJlcG9zaXRvcnk4OTAwNDkxNw==","name":"granite","full_name":"elementary/granite","private":false,"owner":{"login":"elementary","id":1978534,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5Nzg1MzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1978534?v=4","gravatar_id":"","url":"https://api.github.com/users/elementary","html_url":"https://github.com/elementary","followers_url":"https://api.github.com/users/elementary/followers","following_url":"https://api.github.com/users/elementary/following{/other_user}","gists_url":"https://api.github.com/users/elementary/gists{/gist_id}","starred_url":"https://api.github.com/users/elementary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elementary/subscriptions","organizations_url":"https://api.github.com/users/elementary/orgs","repos_url":"https://api.github.com/users/elementary/repos","events_url":"https://api.github.com/users/elementary/events{/privacy}","received_events_url":"https://api.github.com/users/elementary/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/elementary/granite","description":"Library that extends Gtk+","fork":false,"url":"https://api.github.com/repos/elementary/granite","forks_url":"https://api.github.com/repos/elementary/granite/forks","keys_url":"https://api.github.com/repos/elementary/granite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elementary/granite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elementary/granite/teams","hooks_url":"https://api.github.com/repos/elementary/granite/hooks","issue_events_url":"https://api.github.com/repos/elementary/granite/issues/events{/number}","events_url":"https://api.github.com/repos/elementary/granite/events","assignees_url":"https://api.github.com/repos/elementary/granite/assignees{/user}","branches_url":"https://api.github.com/repos/elementary/granite/branches{/branch}","tags_url":"https://api.github.com/repos/elementary/granite/tags","blobs_url":"https://api.github.com/repos/elementary/granite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elementary/granite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elementary/granite/git/refs{/sha}","trees_url":"https://api.github.com/repos/elementary/granite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elementary/granite/statuses/{sha}","languages_url":"https://api.github.com/repos/elementary/granite/languages","stargazers_url":"https://api.github.com/repos/elementary/granite/stargazers","contributors_url":"https://api.github.com/repos/elementary/granite/contributors","subscribers_url":"https://api.github.com/repos/elementary/granite/subscribers","subscription_url":"https://api.github.com/repos/elementary/granite/subscription","commits_url":"https://api.github.com/repos/elementary/granite/commits{/sha}","git_commits_url":"https://api.github.com/repos/elementary/granite/git/commits{/sha}","comments_url":"https://api.github.com/repos/elementary/granite/comments{/number}","issue_comment_url":"https://api.github.com/repos/elementary/granite/issues/comments{/number}","contents_url":"https://api.github.com/repos/elementary/granite/contents/{+path}","compare_url":"https://api.github.com/repos/elementary/granite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elementary/granite/merges","archive_url":"https://api.github.com/repos/elementary/granite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elementary/granite/downloads","issues_url":"https://api.github.com/repos/elementary/granite/issues{/number}","pulls_url":"https://api.github.com/repos/elementary/granite/pulls{/number}","milestones_url":"https://api.github.com/repos/elementary/granite/milestones{/number}","notifications_url":"https://api.github.com/repos/elementary/granite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elementary/granite/labels{/name}","releases_url":"https://api.github.com/repos/elementary/granite/releases{/id}","deployments_url":"https://api.github.com/repos/elementary/granite/deployments","created_at":"2017-04-21T16:45:37Z","updated_at":"2019-05-01T16:42:24Z","pushed_at":"2019-05-06T21:24:54Z","git_url":"git://github.com/elementary/granite.git","ssh_url":"git@github.com:elementary/granite.git","clone_url":"https://github.com/elementary/granite.git","svn_url":"https://github.com/elementary/granite","homepage":null,"size":9290,"stargazers_count":78,"watchers_count":78,"language":"Vala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":26,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":69,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":26,"open_issues":69,"watchers":78,"default_branch":"master"}},"base":{"label":"elementary:master","ref":"master","sha":"47e25f5e79a2afb7328abb86c6755263670033a5","user":{"login":"elementary","id":1978534,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5Nzg1MzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1978534?v=4","gravatar_id":"","url":"https://api.github.com/users/elementary","html_url":"https://github.com/elementary","followers_url":"https://api.github.com/users/elementary/followers","following_url":"https://api.github.com/users/elementary/following{/other_user}","gists_url":"https://api.github.com/users/elementary/gists{/gist_id}","starred_url":"https://api.github.com/users/elementary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elementary/subscriptions","organizations_url":"https://api.github.com/users/elementary/orgs","repos_url":"https://api.github.com/users/elementary/repos","events_url":"https://api.github.com/users/elementary/events{/privacy}","received_events_url":"https://api.github.com/users/elementary/received_events","type":"Organization","site_admin":false},"repo":{"id":89004917,"node_id":"MDEwOlJlcG9zaXRvcnk4OTAwNDkxNw==","name":"granite","full_name":"elementary/granite","private":false,"owner":{"login":"elementary","id":1978534,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5Nzg1MzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1978534?v=4","gravatar_id":"","url":"https://api.github.com/users/elementary","html_url":"https://github.com/elementary","followers_url":"https://api.github.com/users/elementary/followers","following_url":"https://api.github.com/users/elementary/following{/other_user}","gists_url":"https://api.github.com/users/elementary/gists{/gist_id}","starred_url":"https://api.github.com/users/elementary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elementary/subscriptions","organizations_url":"https://api.github.com/users/elementary/orgs","repos_url":"https://api.github.com/users/elementary/repos","events_url":"https://api.github.com/users/elementary/events{/privacy}","received_events_url":"https://api.github.com/users/elementary/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/elementary/granite","description":"Library that extends Gtk+","fork":false,"url":"https://api.github.com/repos/elementary/granite","forks_url":"https://api.github.com/repos/elementary/granite/forks","keys_url":"https://api.github.com/repos/elementary/granite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elementary/granite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elementary/granite/teams","hooks_url":"https://api.github.com/repos/elementary/granite/hooks","issue_events_url":"https://api.github.com/repos/elementary/granite/issues/events{/number}","events_url":"https://api.github.com/repos/elementary/granite/events","assignees_url":"https://api.github.com/repos/elementary/granite/assignees{/user}","branches_url":"https://api.github.com/repos/elementary/granite/branches{/branch}","tags_url":"https://api.github.com/repos/elementary/granite/tags","blobs_url":"https://api.github.com/repos/elementary/granite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elementary/granite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elementary/granite/git/refs{/sha}","trees_url":"https://api.github.com/repos/elementary/granite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elementary/granite/statuses/{sha}","languages_url":"https://api.github.com/repos/elementary/granite/languages","stargazers_url":"https://api.github.com/repos/elementary/granite/stargazers","contributors_url":"https://api.github.com/repos/elementary/granite/contributors","subscribers_url":"https://api.github.com/repos/elementary/granite/subscribers","subscription_url":"https://api.github.com/repos/elementary/granite/subscription","commits_url":"https://api.github.com/repos/elementary/granite/commits{/sha}","git_commits_url":"https://api.github.com/repos/elementary/granite/git/commits{/sha}","comments_url":"https://api.github.com/repos/elementary/granite/comments{/number}","issue_comment_url":"https://api.github.com/repos/elementary/granite/issues/comments{/number}","contents_url":"https://api.github.com/repos/elementary/granite/contents/{+path}","compare_url":"https://api.github.com/repos/elementary/granite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elementary/granite/merges","archive_url":"https://api.github.com/repos/elementary/granite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elementary/granite/downloads","issues_url":"https://api.github.com/repos/elementary/granite/issues{/number}","pulls_url":"https://api.github.com/repos/elementary/granite/pulls{/number}","milestones_url":"https://api.github.com/repos/elementary/granite/milestones{/number}","notifications_url":"https://api.github.com/repos/elementary/granite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elementary/granite/labels{/name}","releases_url":"https://api.github.com/repos/elementary/granite/releases{/id}","deployments_url":"https://api.github.com/repos/elementary/granite/deployments","created_at":"2017-04-21T16:45:37Z","updated_at":"2019-05-01T16:42:24Z","pushed_at":"2019-05-06T21:24:54Z","git_url":"git://github.com/elementary/granite.git","ssh_url":"git@github.com:elementary/granite.git","clone_url":"https://github.com/elementary/granite.git","svn_url":"https://github.com/elementary/granite","homepage":null,"size":9290,"stargazers_count":78,"watchers_count":78,"language":"Vala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":26,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":69,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":26,"open_issues":69,"watchers":78,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elementary/granite/pulls/284"},"html":{"href":"https://github.com/elementary/granite/pull/284"},"issue":{"href":"https://api.github.com/repos/elementary/granite/issues/284"},"comments":{"href":"https://api.github.com/repos/elementary/granite/issues/284/comments"},"review_comments":{"href":"https://api.github.com/repos/elementary/granite/pulls/284/comments"},"review_comment":{"href":"https://api.github.com/repos/elementary/granite/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elementary/granite/pulls/284/commits"},"statuses":{"href":"https://api.github.com/repos/elementary/granite/statuses/645306a847d8c86dc5255b4f35182b08e0f0c4ce"}},"author_association":"MEMBER"}}
other: {"actor":{"display_login":"donadigo"}}