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

cubehelixDefault and rainbow? #9

Closed
mbostock opened this issue Nov 29, 2015 · 2 comments
Closed

cubehelixDefault and rainbow? #9

mbostock opened this issue Nov 29, 2015 · 2 comments
Assignees

Comments

@mbostock
Copy link
Member

Perhaps these could be simple interpolators (taking an argument t in [0,1]) that returns the corresponding color, as is currently implemented in d3-scale.

@mbostock
Copy link
Member Author

Specifically:

var rainbow1 = cubehelixLong(color.cubehelix(-100, 0.75, 0.35), color.cubehelix(80, 1.50, 0.8)),
    rainbow2 = cubehelixLong(color.cubehelix(80, 1.50, 0.8), color.cubehelix(260, 0.75, 0.35));

// Maybe t % 1?
export function rainbow(t) {
  return t < 0.5 ? rainbow1(t * 2) : rainbow2((t - 0.5) * 2);
};

And:

export var cubehelixDefault = cubehelixLong(color.cubehelix(300, 0.5, 0.0), color.cubehelix(-240, 0.5, 1.0));

@mbostock mbostock self-assigned this Nov 30, 2015
@mbostock
Copy link
Member Author

I don’t think this is a good fit for the d3-interpolate module because these interpolators are designed to interpolate between two arbitrary values, not two pre-determined values. So d3-scale seems like the right place for the above… Although, my opinion is not strong.

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

1 participant