MCPcopy
hub / github.com/omgovich/colord / labPlugin

Function labPlugin

src/plugins/lab.ts:28–40  ·  view source on GitHub ↗
(ColordClass, parsers)

Source from the content-addressed store, hash-verified

26 * https://en.wikipedia.org/wiki/CIELAB_color_space
27 */
28const labPlugin: Plugin = (ColordClass, parsers): void => {
29 ColordClass.prototype.toLab = function () {
30 return roundLaba(rgbaToLaba(this.rgba));
31 };
32
33 ColordClass.prototype.delta = function (color = "#FFF") {
34 const compared = color instanceof ColordClass ? color : new ColordClass(color);
35 const delta = getDeltaE00(this.toLab(), compared.toLab()) / 100;
36 return clamp(round(delta, 3));
37 };
38
39 parsers.object.push([parseLaba, "lab"]);
40};
41
42export default labPlugin;

Callers

nothing calls this directly

Calls 6

roundLabaFunction · 0.90
rgbaToLabaFunction · 0.90
getDeltaE00Function · 0.90
clampFunction · 0.90
roundFunction · 0.90
toLabMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…