{"action":"created","issue":{"url":"https://api.github.com/repos/Qix-/color/issues/99","repository_url":"https://api.github.com/repos/Qix-/color","labels_url":"https://api.github.com/repos/Qix-/color/issues/99/labels{/name}","comments_url":"https://api.github.com/repos/Qix-/color/issues/99/comments","events_url":"https://api.github.com/repos/Qix-/color/issues/99/events","html_url":"https://github.com/Qix-/color/issues/99","id":194198053,"number":99,"title":"Feature suggestion: Support mixing with different blend modes","user":{"login":"Loilo","id":1922624,"avatar_url":"https://avatars.githubusercontent.com/u/1922624?v=3","gravatar_id":"","url":"https://api.github.com/users/Loilo","html_url":"https://github.com/Loilo","followers_url":"https://api.github.com/users/Loilo/followers","following_url":"https://api.github.com/users/Loilo/following{/other_user}","gists_url":"https://api.github.com/users/Loilo/gists{/gist_id}","starred_url":"https://api.github.com/users/Loilo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Loilo/subscriptions","organizations_url":"https://api.github.com/users/Loilo/orgs","repos_url":"https://api.github.com/users/Loilo/repos","events_url":"https://api.github.com/users/Loilo/events{/privacy}","received_events_url":"https://api.github.com/users/Loilo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-12-07T23:00:06Z","updated_at":"2016-12-08T20:43:02Z","closed_at":null,"body":"I was about to write my own color library with a nicely clean API which in the end I found to resemble your approach very closely. So I screwed that over and instead would like to propose one big feature I wanted to have in my toolkit but that's missing in this library.\r\n\r\n## What\r\n\r\nI planned a feature that allows mixing of colors not only with the standard \"source-over\" algorithm but with all the standard blend modes that Photoshop and the [W3C](https://www.w3.org/TR/compositing-1/#blendingseparable) are presenting.\r\n\r\n## Who\r\n\r\nIt was a little tricky to find the algorithms for all the blend modes with alpha channel taken into account but I invested quite some time [in researching](http://stackoverflow.com/questions/40796852/mix-two-non-opaque-colors-with-hue-blend-mode) and eventually was successful. So I already completely implemented all the blend modes in TypeScript—it shouldn't be too hard to transfer the implementations to this library. I'd be happy to attach a PR.\r\n\r\n## How\r\n\r\nNow comes the tricky part: What I'm not sure about is how to—in case you're positive about this feature at all—integrate that thing into the existing API.\r\n\r\nThe feature would probably need an all new `.blend()` method as a kind of \"enhanced\" `.mix()` because\r\n\r\na) every architectural approach I took to adjust the `.mix()` parameters for this feature introduced some kind of design flaw.\r\nb) using the existing `.mix()` at all would only work sanely if it by default handled color mixing exactly like the `normal` blend mode does—which isn't the case. That would require calculating the resulting alpha in a different way than just averaging the alphas of the mixed colors.\r\n\r\nYou got any thoughts on this? Do you like the idea? What would be your approach with the API facet?"},"comment":{"url":"https://api.github.com/repos/Qix-/color/issues/comments/265849804","html_url":"https://github.com/Qix-/color/issues/99#issuecomment-265849804","issue_url":"https://api.github.com/repos/Qix-/color/issues/99","id":265849804,"user":{"login":"Qix-","id":885648,"avatar_url":"https://avatars.githubusercontent.com/u/885648?v=3","gravatar_id":"","url":"https://api.github.com/users/Qix-","html_url":"https://github.com/Qix-","followers_url":"https://api.github.com/users/Qix-/followers","following_url":"https://api.github.com/users/Qix-/following{/other_user}","gists_url":"https://api.github.com/users/Qix-/gists{/gist_id}","starred_url":"https://api.github.com/users/Qix-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Qix-/subscriptions","organizations_url":"https://api.github.com/users/Qix-/orgs","repos_url":"https://api.github.com/users/Qix-/repos","events_url":"https://api.github.com/users/Qix-/events{/privacy}","received_events_url":"https://api.github.com/users/Qix-/received_events","type":"User","site_admin":false},"created_at":"2016-12-08T20:43:02Z","updated_at":"2016-12-08T20:43:02Z","body":"So with parameters like that, you have to be able to bind them back to the original color object. You can do it by constructing those properties right then and there (which is expensive and wasteful) or you can defer execution with a getter. I generally opt for the latter."}}
{"actor":{"display_login":"Qix-"}}