Skip to content

import ColorSpace from "https://colorjs.io/src/space.js" doesn't populate registry #491

Answered by sidewayss
sidewayss asked this question in Q&A
Discussion options

You must be logged in to vote

During the lunch break a better approach occurred to me:

import {spaces} from "https://colorjs.io/src/spaces/index.js";
for (space of Object.values(spaces)
    ...

That way I don't need to maintain my own list of spaces, something I had been hoping to avoid. I hadn't examined spaces/index.js until now, so I didn't realize that it was the module that exported the full catalog of color spaces.

I'm answering this question with this comment. Please feel free to comment regardless. I'm curious about why the registry is initialized separately from ColorSpace.

Replies: 4 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by sidewayss
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@MysteryBlokHed
Comment options

@sidewayss
Comment options

@LeaVerou
Comment options

@jgerigmeyer
Comment options

@MysteryBlokHed
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants