{"action":"created","issue":{"url":"https://api.github.com/repos/Ogeon/palette/issues/11","labels_url":"https://api.github.com/repos/Ogeon/palette/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/Ogeon/palette/issues/11/comments","events_url":"https://api.github.com/repos/Ogeon/palette/issues/11/events","html_url":"https://github.com/Ogeon/palette/issues/11","id":126869635,"number":11,"title":"Find a good way to decouple the alpha channel","user":{"login":"Ogeon","id":225229,"avatar_url":"https://avatars.githubusercontent.com/u/225229?v=3","gravatar_id":"","url":"https://api.github.com/users/Ogeon","html_url":"https://github.com/Ogeon","followers_url":"https://api.github.com/users/Ogeon/followers","following_url":"https://api.github.com/users/Ogeon/following{/other_user}","gists_url":"https://api.github.com/users/Ogeon/gists{/gist_id}","starred_url":"https://api.github.com/users/Ogeon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ogeon/subscriptions","organizations_url":"https://api.github.com/users/Ogeon/orgs","repos_url":"https://api.github.com/users/Ogeon/repos","events_url":"https://api.github.com/users/Ogeon/events{/privacy}","received_events_url":"https://api.github.com/users/Ogeon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-15T13:13:47Z","updated_at":"2016-01-19T17:30:44Z","closed_at":null,"body":"Having the alpha channel being affected by operations as arithmetics isn't always what you want, so it would be nice if it can be separated from the color types in a good, convenient and intuitive enough way. This is also useful for when the alpha channel is insignificant (always 1.0), to save some space. I have been thinking about an `Alpha<C>` wrapper type along these lines:\r\n\r\n```rust\r\nstruct Alpha<C> {\r\n    pub color: C,\r\n    pub alpha: f32,\r\n}\r\n\r\nimpl<C: Mix> Mix for Alpha<C> {\r\n    //...\r\n}\r\n\r\n//etc.\r\n```\r\n\r\nand maybe even make it dereference as the color type `C`. I don't know if this will end up being too inconvenient or not, and better solutions are always welcome. I'll see if I can figure something else out before making a test implementation."},"comment":{"url":"https://api.github.com/repos/Ogeon/palette/issues/comments/172926771","html_url":"https://github.com/Ogeon/palette/issues/11#issuecomment-172926771","issue_url":"https://api.github.com/repos/Ogeon/palette/issues/11","id":172926771,"user":{"login":"Ogeon","id":225229,"avatar_url":"https://avatars.githubusercontent.com/u/225229?v=3","gravatar_id":"","url":"https://api.github.com/users/Ogeon","html_url":"https://github.com/Ogeon","followers_url":"https://api.github.com/users/Ogeon/followers","following_url":"https://api.github.com/users/Ogeon/following{/other_user}","gists_url":"https://api.github.com/users/Ogeon/gists{/gist_id}","starred_url":"https://api.github.com/users/Ogeon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ogeon/subscriptions","organizations_url":"https://api.github.com/users/Ogeon/orgs","repos_url":"https://api.github.com/users/Ogeon/repos","events_url":"https://api.github.com/users/Ogeon/events{/privacy}","received_events_url":"https://api.github.com/users/Ogeon/received_events","type":"User","site_admin":false},"created_at":"2016-01-19T17:30:44Z","updated_at":"2016-01-19T17:30:44Z","body":"> `my_var.color.red` vs `my_var.red`\r\n\r\nThat's what I thought `Deref` and `DerefMut` could help with. Here is a simple case with the same structure: http://is.gd/vjZBpI\r\n\r\n> Its pretty much going to be the same amount of work. Both will need additional traits for converting Rgba -> Laba vs Rgb -> Lab etc.\r\n\r\nDepends on if this will work:\r\n\r\n```rust\r\nimpl<T, U> From<Alpha<T>> for Alpha<U> where U: From<T> {\r\n    //...\r\n}\r\n```"}}