purescript-colors icon indicating copy to clipboard operation
purescript-colors copied to clipboard

Adjust alpha value

Open i-am-the-slime opened this issue 4 years ago • 3 comments

Is there a combinator or another way to adjust the alpha value of a given (HSLA) colour?

i-am-the-slime avatar Mar 28 '21 21:03 i-am-the-slime

I don't think there is (haven't worked on this project for a while). But Color is just

data Color = HSLA Hue Number Number Number

with the last Number being the alpha value. So you should be able to modify it "by hand".

sharkdp avatar Apr 03 '21 20:04 sharkdp

It seems that the constructor isn't exported so we can't pattern match on it.

paulyoung avatar Apr 29 '22 01:04 paulyoung

I'm not sure the constructor should be exported. Plus, that would be a breaking change and I'd rather not have to fix that, too.

So, perhaps a function like Either's either that exposes the values wrapped by Color could be added in a PR as a non-breaking change?

JordanMartinez avatar Apr 29 '22 10:04 JordanMartinez