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.
As discussed with @tabatkins, there are several changes we want to make to the signatures of .get() and .set():
Separate color space and coordinate name arguments instead of space.coordName microsyntax. This allows color spaces to be strings OR ColorSpace objects, coord names can be strings or numerical indices, and it lends itself nicely to modifying multiple coordinates of the same color space at once.
The coordname and value can either be separate arguments, or an object literal of coord names and values. This allows things like:
color.set("lch", {
l: l => l * 1.2,
c: c => c + 20
});
As discussed with @tabatkins, there are several changes we want to make to the signatures of
.get()
and.set()
:space.coordName
microsyntax. This allows color spaces to be strings ORColorSpace
objects, coord names can be strings or numerical indices, and it lends itself nicely to modifying multiple coordinates of the same color space at once.