(ColordClass, parsers)
| 26 | * https://en.wikipedia.org/wiki/CIELAB_color_space |
| 27 | */ |
| 28 | const 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 | |
| 42 | export default labPlugin; |
nothing calls this directly
no test coverage detected
searching dependent graphs…