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

Make DeltaEMethod a string #16

Open LeaVerou opened 2 years ago

LeaVerou commented 2 years ago

As discussed with @tabatkins, to allow DeltaEMethod to be extensible, it should be a string instead of an enum, and the values can be checked via the implementation.

svgeesus commented 2 years ago

The two standard values should be "dE76" and "dE2000"; the first because it is fast, and may be good enough in some cases; and the latter because it is the most accurate method when that matters.

LeaVerou commented 2 years ago

Why prefix them all with dE? That's a bit clunky: color.deltaE(color2, "dE76")

svgeesus commented 2 years ago

Sure, if the method name already gives context it can be omitted

svgeesus commented 2 years ago

OK so the two standard values would be "76" and "2000".

LeaVerou commented 1 year ago

After talking with @tabatkins again, we only need to make it a string if we want it to be user extensible. I propose that, in the interest of keeping API surface small, we ship with an enum now, and we can always relax it later, when we add a way for authors to add deltaE methods.

That said, are we still good with only "76" and "2000"? Do we also need to add "OK"?