Skip to content

Commit

Permalink
Make mix plugin work without lch plugin enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
omgovich authored and Vlad Shilov committed Apr 28, 2021
1 parent 718ac6e commit 446887a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
},
{
"path": "dist/plugins/lch.mjs",
"limit": "1.1 KB"
"limit": "1.25 KB"
},
{
"path": "dist/plugins/mix.mjs",
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/mix.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AnyColor, LchaColor } from "../types";
import { AnyColor, RgbaColor } from "../types";
import { Plugin } from "../extend";
import { rgbaToLcha } from "../colorModels/lch";
import { lchaToRgba, rgbaToLcha } from "../colorModels/lch";

declare module "../colord" {
interface Colord {
Expand All @@ -26,12 +26,12 @@ const mixPlugin: Plugin = (ColordClass): void => {
const lcha1 = rgbaToLcha(this.toRgb());
const lcha2 = rgbaToLcha(instance2.toRgb());

const mixture: LchaColor = {
const mixture: RgbaColor = lchaToRgba({
l: lcha1.l * (1 - ratio) + lcha2.l * ratio,
c: lcha1.c * (1 - ratio) + lcha2.c * ratio,
h: lcha1.h * (1 - ratio) + lcha2.h * ratio,
a: lcha1.a * (1 - ratio) + lcha2.a * ratio,
};
});

return new ColordClass(mixture);
};
Expand Down

0 comments on commit 446887a

Please sign in to comment.