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

Remove ColorSpace.iccProfile, add ColorSpace.load(iccProfile) #18

Closed LeaVerou closed 2 years ago

LeaVerou commented 2 years ago

As discussed with @tabatkins, having the iccProfile be part of the ColorSpace API shape means that everything needs to be asynchronous.

Far better to just include a static load() method on ColorSpace that takes a profile URL and resolves to a ColorSpace object with its properties prefilled.

interface ColorSpace {
 static Promise<ColorSpace> load(RequestInfo input, optional
RequestInit init = {});
 /* same signature as fetch() */
};

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().