Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add bezier sample #28

Open
safareli opened this issue Aug 15, 2017 · 3 comments
Open

add bezier sample #28

safareli opened this issue Aug 15, 2017 · 3 comments

Comments

@safareli
Copy link
Contributor

safareli commented Aug 15, 2017

I was reading about color scales and color palettes and came across this:
https://gka.github.io/palettes
https://www.vis4.net/blog/posts/mastering-multi-hued-color-scales/

Author uses this method, which is not robust in sense that it works with only 5 colors. But we can port this to have bezier for arbitrary number of arbitrary dimensional vectors. (this and this might be useful for implementing it)

From API perspective we would have add another function sampleBezier but as colors and cssColorStops refer to sample directly they would need to be updated so we can pass different sampling function as argument.

@sharkdp
Copy link
Collaborator

sharkdp commented Aug 15, 2017

Sounds good!

One option to keep the API backwards-compatible would be to introduce colors' (maybe with a better name) like this:

type InterpolationMethod = Number -> Number

sample' :: InterpolationMethod -> ColorScale -> Number -> Color
sample' = ...

linearInterpolation :: InterpolationMethod
bezierInterpolation :: InterpolationMethod

sample :: ColorScale -> Number -> Color
sample = sample' linearInterpolation

(modulo names for functions and types)

https://www.vis4.net/blog/posts/mastering-multi-hued-color-scales/

(unfortunately does not work at the moment)

@safareli
Copy link
Contributor Author

(modulo names for functions and types)

?

(unfortunately does not work at the moment)

archive.org :d

http://web.archive.org/web/20170613051029/https://www.vis4.net/blog/posts/mastering-multi-hued-color-scales/

@sharkdp
Copy link
Collaborator

sharkdp commented Aug 15, 2017

(modulo names for functions and types)
?

Meaning: we probably could choose better names

Thanks for the archived link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants