Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upalpha should be smart enough to handle values in [0, 1] automatically #37
Comments
|
I think it's a simple implementation (on branch
'just works' too. However, what should |
|
@MichaelChirico If I were to implement this, should I change the accepted values of alpha from [0,255] to [1,256], so that it's more obvious that anything in [0,1] will be treated as a percentage? |
|
@SymbolixAU I think no... only Will come back to this again when I'm off vacation... |
|
I've merged this into master in this commit, so now alpha is
I'm still not entirely 100% sure about this... and I don't know why... |
|
Hopefully this is a case of the beauty of dynamically-typed languages... |
|
Thanks! Can't wait to give it a spin
…On Mon, Jan 14, 2019 at 5:05 AM SymbolixAU ***@***.***> wrote:
Closed #37 <#37> via
530a73a
<530a73a>
.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#37 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHQQdT7ZhKu2s7hKjFRFoQF7TronTmffks5vC5-LgaJpZM4ZACbg>
.
|
I think it's more common for people to think of
alphaas a percentage, so I think it's natural to expectcolourvalues(x, alpha = .5)to "just work".From a design perspective, it's basically trivial to just detect fractions in
alphaand multiply them by 255... simple truncation should be OK as I think the visual difference betweenalpha = 128andalpha = 129must be close to 0.Things get interesting at the edge cases like
alpha = c(0, 1, 1, 0)... I guess very few people will be usingalpha = c(0, 1, 1, 0)on the255scale, so the logic to handle this requires some assumptions but I think they are pretty lightweight.I'm happy to implement this functionality as a PR if you see fit.