WICG / color-api

A proposal and draft spec for a Color object for the Web Platform, loosely influenced by the Color.js work. Heavily WIP, if you landed here randomly, please move along.
https://wicg.github.io/color-api/
Other
130 stars 3 forks source link

What to do with coordinate names when loading a ColorSpace from an ICC profile? #20

Closed svgeesus closed 1 year ago

svgeesus commented 2 years ago

Noted in passing in another issue

Unfortunately, coordinate names cannot always be determined via the ICC profile, so this may need to include something to set those, and thus, its signature would not necessarily be the same as fetch().

tabatkins commented 2 years ago

Also quoting from that issue:

Unfortunately, coordinate names cannot always be determined via the ICC profile, so this may need to include something to set those, and thus, its signature would not necessarily be the same as fetch().

An alternative method signature is to take a Response, so we can delegate the fetching stuff purely to fetch() and just let you pass the result directly in: ColorSpace.load(await fetch(...)).

(In addition to taking the profile data directly, if you've cached it or something, presumably as a DOMString.)

This way, we have the rest of the method signature available to pass in a (possibly reduced?) options argument, so we can set/override coord names and anything else.

LeaVerou commented 2 years ago

My main concern with that is the memory consumption of passing 3MB strings around. But I'm not an expert on that sort of thing.

LeaVerou commented 2 years ago

Note that we could do both:

ColorSpace.load((Response or CSSOMString) resource, reducedOptions options)
tabatkins commented 2 years ago

Yeah, that was my intention.

LeaVerou commented 1 year ago

Both suggestions are now in the spec.