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

`color.toGamut()` in place? #5

Closed svgeesus closed 1 year ago

svgeesus commented 3 years ago

Currently this method returns a new instance. Should it instead make the adjustment in place?

LeaVerou commented 1 year ago

I think it's pretty weird to make it in-place when specifying a different color space. So, we should either drop that sugar (authors can always do color.to(space).toGamut()) OR continue having a function that returns a new object.

Thoughts, @tabatkins ?

tabatkins commented 1 year ago

Agreed, either it should stay in the same color space and just come into gamut, or it should always return a fresh object.

Given the current name, I think the parallel with .to() is worthwhile to maintain, so it should always return a fresh object; if we wanted to remove the conversion we might want to slightly rename it too.

LeaVerou commented 1 year ago

Agreed, so I'm gonna go ahead and close this.