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

Improve color parsing #2

Closed
jjhembd opened this issue Jun 24, 2020 · 2 comments
Closed

Improve color parsing #2

jjhembd opened this issue Jun 24, 2020 · 2 comments

Comments

@jjhembd
Copy link
Collaborator

jjhembd commented Jun 24, 2020

Colors are currently parsed with csscolorparser. This dependency forces a bundling step with rollup-plugin-commonjs. Also, default and constant values are left as CSS strings, requiring a second parsing step during rendering.

Proposed changes:

  • Switch to d3-color for parsing. This is a modern, well-maintained ES module, that will eliminate the need for a build step
  • Consider d3-interpolate for interpolation? (or is this too heavy?)
  • Convert all colors (including constants and defaults) to 4-element arrays of clamped floats, suitable for use in WebGL
@jjhembd
Copy link
Collaborator Author

jjhembd commented Jun 24, 2020

Update: switched to d3-color in v0.2.3.

Still need to re-think color interpolation (currently doing linear interpolation in RGBA space), and convert all colors to a WebGL-friendly format

@jjhembd
Copy link
Collaborator Author

jjhembd commented Dec 14, 2020

Fixed in 671173f : now returning all colors as 4-element arrays of clamped floats.
Interpolation is still linear in RGBA, will leave this to a different issue.

@jjhembd jjhembd closed this as completed Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant