{"action":"created","issue":{"url":"https://api.github.com/repos/jupyterlab/jupyterlab/issues/5232","repository_url":"https://api.github.com/repos/jupyterlab/jupyterlab","labels_url":"https://api.github.com/repos/jupyterlab/jupyterlab/issues/5232/labels{/name}","comments_url":"https://api.github.com/repos/jupyterlab/jupyterlab/issues/5232/comments","events_url":"https://api.github.com/repos/jupyterlab/jupyterlab/issues/5232/events","html_url":"https://github.com/jupyterlab/jupyterlab/pull/5232","id":354911916,"node_id":"MDExOlB1bGxSZXF1ZXN0MjExNTY0NDE5","number":5232,"title":"Makes matplotlib figs with dark text legible in the dark theme (and related fixes)","user":{"login":"telamonian","id":2263641,"node_id":"MDQ6VXNlcjIyNjM2NDE=","avatar_url":"https://avatars2.githubusercontent.com/u/2263641?v=4","gravatar_id":"","url":"https://api.github.com/users/telamonian","html_url":"https://github.com/telamonian","followers_url":"https://api.github.com/users/telamonian/followers","following_url":"https://api.github.com/users/telamonian/following{/other_user}","gists_url":"https://api.github.com/users/telamonian/gists{/gist_id}","starred_url":"https://api.github.com/users/telamonian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telamonian/subscriptions","organizations_url":"https://api.github.com/users/telamonian/orgs","repos_url":"https://api.github.com/users/telamonian/repos","events_url":"https://api.github.com/users/telamonian/events{/privacy}","received_events_url":"https://api.github.com/users/telamonian/received_events","type":"User","site_admin":false},"labels":[{"id":494203090,"node_id":"MDU6TGFiZWw0OTQyMDMwOTA=","url":"https://api.github.com/repos/jupyterlab/jupyterlab/labels/pkg:rendermime","name":"pkg:rendermime","color":"1d76db","default":false},{"id":601544712,"node_id":"MDU6TGFiZWw2MDE1NDQ3MTI=","url":"https://api.github.com/repos/jupyterlab/jupyterlab/labels/pkg:themes","name":"pkg:themes","color":"1d76db","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/jupyterlab/jupyterlab/milestones/18","html_url":"https://github.com/jupyterlab/jupyterlab/milestone/18","labels_url":"https://api.github.com/repos/jupyterlab/jupyterlab/milestones/18/labels","id":3564568,"node_id":"MDk6TWlsZXN0b25lMzU2NDU2OA==","number":18,"title":"0.35","description":"","creator":{"login":"blink1073","id":2096628,"node_id":"MDQ6VXNlcjIwOTY2Mjg=","avatar_url":"https://avatars2.githubusercontent.com/u/2096628?v=4","gravatar_id":"","url":"https://api.github.com/users/blink1073","html_url":"https://github.com/blink1073","followers_url":"https://api.github.com/users/blink1073/followers","following_url":"https://api.github.com/users/blink1073/following{/other_user}","gists_url":"https://api.github.com/users/blink1073/gists{/gist_id}","starred_url":"https://api.github.com/users/blink1073/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blink1073/subscriptions","organizations_url":"https://api.github.com/users/blink1073/orgs","repos_url":"https://api.github.com/users/blink1073/repos","events_url":"https://api.github.com/users/blink1073/events{/privacy}","received_events_url":"https://api.github.com/users/blink1073/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":104,"state":"closed","created_at":"2018-08-13T09:33:31Z","updated_at":"2018-10-13T10:47:31Z","due_on":"2018-10-04T07:00:00Z","closed_at":"2018-10-13T10:47:31Z"},"comments":6,"created_at":"2018-08-28T21:31:20Z","updated_at":"2018-10-22T16:54:59Z","closed_at":"2018-08-29T11:46:19Z","author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/jupyterlab/jupyterlab/pulls/5232","html_url":"https://github.com/jupyterlab/jupyterlab/pull/5232","diff_url":"https://github.com/jupyterlab/jupyterlab/pull/5232.diff","patch_url":"https://github.com/jupyterlab/jupyterlab/pull/5232.patch"},"body":"This is the sister PR of ipython/ipykernel#336.\r\n\r\nThis PR fixes a number of Matplotlib/Jupyterlab legibility issues. Given appropriate metadata (which the sister PR adds to ipykernel), Jupyterlab will now, if needed, set a background behind figures based on the luminance (ie light or dark) of the colors of its tick labels. This fix does not monkeypatch or change the actual figure in any way.\r\n\r\nBased on the value of the `needs-background` metadata entry, Jupyterlab will now add either a `needs-light-background` or a `needs-dark-background` class (or nothing, if `needs-background` is not passed) to the img node that displays the figure. The background of the img node is then styled using a CSS selector that matches on the light/dark nature of the current theme and on the `needs-x-background` class. This is nice, since it means that the figure backgrounds will update as needed if the theme changes.\r\n\r\nHere's what the fix looks like in action:\r\n\r\n## Light theme\r\n### Pre-fix\r\n![image](https://user-images.githubusercontent.com/2263641/44753528-63e8b900-aaec-11e8-8255-a3bd49675829.png)\r\n\r\n### Post-fix\r\n![image](https://user-images.githubusercontent.com/2263641/44753664-d6f22f80-aaec-11e8-8d11-0c8385640d28.png)\r\n\r\n## Dark theme\r\n### Pre-fix\r\n![image](https://user-images.githubusercontent.com/2263641/44753573-909cd080-aaec-11e8-8ef6-df504e686e55.png)\r\n\r\n### Post-fix\r\n![image](https://user-images.githubusercontent.com/2263641/44753706-fee19300-aaec-11e8-92aa-b093c2abf02e.png)\r\n\r\n## What happens when the ticks have different colors?\r\n\r\nThis PR is meant to fix the Jupyterlab dark theme/Matplotlib default style conflict, and also to deal with any similar issues. This fix is not meant to cover ever possible visibility/legibility edge case out there. In particular, when the ticks of a figure have different colors, a background is added only if all of the ticks are light or if all are dark:\r\n\r\n![image](https://user-images.githubusercontent.com/2263641/44754396-a95ab580-aaef-11e8-80c6-68176cdfd628.png)\r\n\r\nIf the luminance of the ticks does not match, then no background is added:\r\n\r\n![image](https://user-images.githubusercontent.com/2263641/44754631-972d4700-aaf0-11e8-9904-013a694694f4.png)\r\n\r\n\r\nThanks to @bollwyvl, @Carreau, and @ian-r-rose for helping me figure out all of the moving parts needed for this fix during the Jupytercon sprint. This PR has a dependency on the extra figure metadata (`'needs-background'`) added by ipython/ipykernel#336. If, for whatever reason, `'needs-background'` is not present in the metadata, the current Jupyterlab behavior is left completely unchanged."},"comment":{"url":"https://api.github.com/repos/jupyterlab/jupyterlab/issues/comments/431895799","html_url":"https://github.com/jupyterlab/jupyterlab/pull/5232#issuecomment-431895799","issue_url":"https://api.github.com/repos/jupyterlab/jupyterlab/issues/5232","id":431895799,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTg5NTc5OQ==","user":{"login":"Carreau","id":335567,"node_id":"MDQ6VXNlcjMzNTU2Nw==","avatar_url":"https://avatars3.githubusercontent.com/u/335567?v=4","gravatar_id":"","url":"https://api.github.com/users/Carreau","html_url":"https://github.com/Carreau","followers_url":"https://api.github.com/users/Carreau/followers","following_url":"https://api.github.com/users/Carreau/following{/other_user}","gists_url":"https://api.github.com/users/Carreau/gists{/gist_id}","starred_url":"https://api.github.com/users/Carreau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Carreau/subscriptions","organizations_url":"https://api.github.com/users/Carreau/orgs","repos_url":"https://api.github.com/users/Carreau/repos","events_url":"https://api.github.com/users/Carreau/events{/privacy}","received_events_url":"https://api.github.com/users/Carreau/received_events","type":"User","site_admin":false},"created_at":"2018-10-22T16:54:59Z","updated_at":"2018-10-22T16:54:59Z","author_association":"CONTRIBUTOR","body":"No problem, we're here to help. \r\n\r\nI would advise against replacing files, that would likely put anaconda in an inconsistant state. \r\nUsually using `pip install -e .` or other instructions in above links will just make your clone \"shadow\" the anaconda installed one, and allow proper uninstall/removal. "}}
{"actor":{"display_login":"Carreau"}}